|
From: | Yury Gribov |
Subject: | Re: [Bug-readline] [PATCH] Enable visibility annotations |
Date: | Thu, 14 Apr 2016 17:41:54 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 04/14/2016 05:07 PM, Pedro Alves wrote:
On 04/14/2016 01:28 PM, Yury Gribov wrote:Thanks, this sounds as a general problem with visibility enabling. Is there some (relatively straightforward) way to find all used symbols? I'm afraid there'll be more than just _rl_*...I don't know of one, other than a mass rebuild (which is something that I have never done myself). A cheap proxy may be to look under /usr/bin /usr/lib etc. for binaries with DTNEEDED readline, and then compare all of readline's extern symbols with the binary binaries' set of extern symbols, check for overlap in symbols that are not prefixed "rl_".
Good idea, here are results for my Ubuntu 14 (I simply look for any symbol intersections):
# Find all imported symbols in rootfsfor f in $(find /bin /sbin /usr/bin /usr/sbin /usr/lib* /lib*); do if file $f | grep -q ELF; then readelf -sDW $f | awk '/UND/{print $9}'; fi ; done > all_undefs.lst
sort -u all_undefs.lst > all_undefs_sorted.lst # Find symbols exported by original readlinereadelf -sDW ~/install/readline/lib/libhistory.so | awk '!/UND/{print $9}' > rl_orig.lst readelf -sDW ~/install/readline/lib/libreadline.so | awk '!/UND/{print $9}' >> rl_orig.lst
sort -u rl_orig.lst > rl_orig_sorted.lst # Find symbols exported by new readlinereadelf -sDW ~/install/readline-patched/lib/libhistory.so | awk '!/UND/{print $9}' > rl_new.lst readelf -sDW ~/install/readline-patched/lib/libreadline.so | awk '!/UND/{print $9}' >> rl_new.lst
sort -u rl_new.lst > rl_new_sorted.lst # Symbols from old readline which may be used somewhere $ comm -12 all_undefs_sorted.lst rl_orig_sorted.lst _rl_qsort_string_compare xmalloc # Symbols from new readline which may be used somewhere $ comm -12 all_undefs_sorted.lst rl_new_sorted.lst _rl_qsort_string_compare Whoever needs xmalloc should not link to libreadline :) -Y
[Prev in Thread] | Current Thread | [Next in Thread] |