This is needed to be able to run check-links.sh against a "sysrooted"
binary while ensuring that the ldd(1) call done on the host uses the
host libc. It is not possible to set LD_LIBRARY_PATH before calling
check-links.sh as then the "sysrooted" libc would be incorrectly used.
A LD_PRELOAD=libc.so is used to ldd(1) as it needs to use the host libc
to run. ldd(1) is a simple wrapper around execve(2) and dlopen(2) with
env LD_TRACE_LOADED_OBJECTS set. Due to the dlopen(2) restriction on
shared library tracing ldd(1) is still required for this lookup.
Sponsored by: EMC / Isilon Storage Division
linked libraries. Only do this for BSS symbols that have a size which avoids
__bss_start. Without this some libraries would be considered unneeded even
though they were providing a B symbol.
- Add in the symbols from crt1.o to cover a handful of common unresolved symbols.
- Consider (C) common data symbols as provided by libraries/crt1.
- Move libkey() function to more appropriate place.
Sponsored by: EMC / Isilon Storage Division
Ran against /usr/local/sbin/pkg:
Before: 25.12 real 12.41 user 33.14 sys
After: 0.53 real 0.49 user 0.13 sys
- Exit with 1 if any missing or unresolved symbol is detected.
- Add option '-U' to skip looking up unresolved symbols.
- Don't consider provided weak objects as unresolved (nm V).
Sponsored by: EMC / Isilon Storage Division
- Fix not finding global symbols by checking for D and R.
- Follow symlinks
- Show which matching symbol was used to consider the library needed.
Discussed with: bapt