Home | History | Annotate | Download | only in ldd
History log of /src/usr.bin/ldd/ldd.c
RevisionDateAuthorComments
 1.28  04-Jan-2023  mrg avoid printing the latest error message if some ldd method worked.
 1.27  18-Oct-2022  mrg branches: 1.27.2;
only try the other methods if the previous ones failed.

fixes problem reported by ryoon@
 1.26  15-Oct-2022  mrg ldd(1): add a -v option to display all errors not just the latest.

ldd on a go binary currently fails with an error that basically
says "not elf32 class". this is a true statement, as it is an
elf64 class object, but it's not useful. it happens because
ldd_elf64() is called, fails in _rtld_map_object(), and then
ldd_elf32() is called, and it fails because the class is wrong,
and only this error is returned. (this problem remains. the
call to map the object fails due to there being 3 instead of 2
elf segments in the file. i guess we need similar code in
ld.elf_so/map_objects.c as the kernel gained some time ago.)

perhaps the first error, not the last error, should be used if
everything fails, but this allows all failures to be see and
would be useful even if the error string handling changed.
 1.25  23-Jul-2021  martin gcc hates strncpy()
 1.24  22-Jul-2021  christos rtld expects an absolute path in execname provided via AUXV in order to
handle $ORIGIN properly and checks for that. Since we are calling its guts
directly, provide one.
 1.23  25-Dec-2017  maya Return a non-zero (one) exit code on failure for one of the files

But keep on processing them, like ls, rm, and other programs do
 1.22  02-Mar-2014  matt Use OBJECT_FMTS from <bsd.own.mk> to determine elf32/elf64 needs
 1.21  20-Mar-2013  macallan apply kludge to make this more or less work on mips64 with n32 userland
with this ldd can handle both 64 and n32 binaries ( previously it would do 64
only ), o32 support is still broken
Someone more familiar with this code needs to fix this properly.
 1.20  08-Jul-2012  matt branches: 1.20.2;
Make sure stuff using Obj_Entry is compiled correctly for ELF32 or ELF64.
 1.19  24-May-2011  joerg branches: 1.19.4;
Fix sign compare
 1.18  29-Mar-2011  joerg Block signals when using the exclusive lock.
 1.17  25-Mar-2011  joerg Add basic locking to ld.elf_so.
 1.16  09-Mar-2011  joerg Add TLS support infrastructure. For dynamic binaries, ld.elf_so exports
_rtld_tls_allocate and _rtld_tls_free. libpthread uses this functions to
setup the thread private area of all new threads. ld.elf_so is
responsible for setting up the private area for the initial thread.
Similar functions are called from _libc_init for static binaries, using
dl_iterate_phdr to access the ELF Program Header.

Add test cases to exercise the different TLS storage models. Test cases
are compiled and installed on all platforms, but are skipped on
platforms not marked for TLS support.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.

It is inspired by the TLS support in FreeBSD by Doug Rabson and the
clean ups of the DragonFly port of the original FreeBSD modifications.
 1.15  16-Oct-2010  skrll Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.
 1.14  27-Feb-2010  roy Sync against new ld.elf_so
 1.13  23-Feb-2010  skrll Mark each object as printed as visited and then print.

Fixes PR/42811.

As a side effect the libraries are printed in, imo, a better order.
 1.12  13-Dec-2009  mrg - adjust the logic for compat ldd: add an elf32_compat module and arrange
for mips64 to build this with MLIBDIR set to o32
- make mips64 ldd call elf32_compat_ldd as well
- make mips64 elf64 set MLIBDIR to 64
- don't need ld.elf_so's Makefile.ld32 files anymore (they are going away
soon anyway)

tested on amd64 and sparc64, and an earlier version tested on mips64.
 1.11  17-Nov-2009  skrll Make _rtld_pagesz of type size_t.

Fixes round_down for alpha which made ldd(1) break.
 1.10  07-Sep-2009  dholland Add an -o option that behaves like nm -o. Implementation from a suggestion
by jmcneill (thanks!); ok mrg. Closes PR 41994.
 1.9  22-Aug-2009  mrg kill ldd_aout. it didn't work anyway...not since i don't know when.
 1.8  20-Aug-2009  he Don't try to call the (no longer defined) aout_ldd() function
if we're building for mips.
 1.7  20-Aug-2009  he Don't include <a.out.h> unless it's needed, and don't build
the aout subdir if on mips. Fixes build for mips ports.
 1.6  20-May-2009  christos catch up with rtld changes
 1.5  03-Feb-2009  mrg rework the main loop and handlers:
- open() and close() the file in the main loop
- pass the fd down into the handlers
- use _rtld_error() in ELFNAME(ldd)

this fixes PR#40543 and also makes error messages look better.
 1.4  07-Jan-2009  mrg - rework this a bunch to make it work inside /rescue/ldd.
- fix alpha build.
 1.3  06-Jan-2009  mrg - get rid of building an a.out-happy ldd (but keep supporting a.out
binaries for the ELF version.)

- convert a.out, elf32 and elf64 support into convience libraries and
link them right ones in. if elf_ldd() fails on 64 bit platforms,
try elf32_ldd() before aout_ldd().


now ldd on 64 bit platforms works for 32 bit binaries, aka PR#40199,
and it seems that all the issues from README are gone too.
 1.2  15-Dec-1998  pk branches: 1.2.12;
Move a.out version of ldd(1) to the usr.bin tree; elf and a.out
reside in separate subdirectories (various source moved by
repository copying). Adapt Makefiles to new situation.
 1.1  16-Dec-1996  cgd First cut at an elf-aware ldd. Originally from John Polstra's FreeBSD elf
kit, then hacked on by Matt Thomas <matt@3am-software.com>, then by me.
This runs, but it's in serious need of cleaning and/or a fair bit of
reworking. See the README file for more information, and a list of things
to do.
 1.2.12.4  17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by skrll in ticket #1724):
rescue/list.ldd: revision 1.4
lib/libc/dlfcn/dlfcn_elf.c: revision 1.7
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.57
distrib/sets/lists/comp/mi: revision 1.1512
share/man/man3/Makefile: revision 1.56
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.58
usr.bin/ldd/ldd.c: revision 1.15
libexec/ld.elf_so/rtld.h: revision 1.84
share/man/man3/dl_iterate_phdr.3: revision 1.1
libexec/ld.elf_so/rtld.c: revision 1.129
libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.44
libexec/ld.elf_so/rtld.h: revision 1.89
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.36
libexec/ld.elf_so/map_object.c: revision 1.41
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.37
libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.46
include/link_elf.h: revision 1.10
libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.29
libexec/ld.elf_so/arch/vax/mdreloc.c: revision 1.26
libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.34
libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.31
libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.35
libexec/ld.elf_so/Makefile: revision 1.94
libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.32
libexec/ld.elf_so/Makefile: revision 1.95
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.31
libexec/ld.elf_so/Makefile: revision 1.96
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.32
libexec/ld.elf_so/reloc.c: revision 1.98
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.33
sys/sys/exec_elf.h: revision 1.106
libexec/ld.elf_so/rtld.c: revision 1.130
libexec/ld.elf_so/load.c: revision 1.37
libexec/ld.elf_so/rtld.c: revision 1.131
libexec/ld.elf_so/load.c: revision 1.38
libexec/ld.elf_so/rtld.h: revision 1.90
libexec/ld.elf_so/headers.c: revision 1.36
libexec/ld.elf_so/rtld.h: revision 1.95
libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.30
libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.25
libexec/ld.elf_so/symbol.c: revision 1.50
libexec/ld.elf_so/symbol.c: revision 1.51
libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.43
libexec/ld.elf_so/symbol.c: revision 1.52
libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.27
libexec/ld.elf_so/symbol.c: revision 1.54
PR/39240: Satoshi Suetake: Don't fail when attempting to resolve weak symbols
when we are doing immediate binding, leave them alone and they will be dealt
with later during lazy binding. From skrll@
Implement negative cache checks for symbol lookups.
Uses the Donelist idea from FreeBSD.
Use alloca(3) instead of local xmalloc for creating our DoneLists.
This allows threaded programs to use us a little better, PR lib/43005.
Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
 1.2.12.3  06-Mar-2010  sborrill Pull up the following revisions(s) (requested by skrll in ticket #1318):
usr.bin/ldd/ldd.c: revision 1.13

Mark each object as printed as visited and then print. Fixes PR/42811.
Improve print order.
 1.2.12.2  25-Feb-2009  snj branches: 1.2.12.2.4;
Pull up following revision(s) (requested by mrg in ticket #483):
usr.bin/ldd/ldd.c: revision 1.5
usr.bin/ldd/ldd.h: revision 1.2
usr.bin/ldd/ldd_aout.c: revision 1.3
usr.bin/ldd/ldd_elfxx.c: revision 1.2
rework the main loop and handlers:
- - open() and close() the file in the main loop
- - pass the fd down into the handlers
- - use _rtld_error() in ELFNAME(ldd)
this fixes PR#40543 and also makes error messages look better.
 1.2.12.1  16-Jan-2009  bouyer Pull up following revision(s) (requested by mrg in ticket #265):
libexec/ld.elf_so/headers.c: revision 1.27
rescue/list: revision 1.35
libexec/ld.elf_so/arch/sparc/Makefile.ld32: revision 1.1
usr.bin/ldd/Makefile.elf: revision 1.1
usr.bin/ldd/Makefile.elf: revision 1.2
usr.bin/ldd/ldd_aout/ldd.c: file removal
usr.bin/ldd/Makefile.elf: revision 1.3
libexec/ld.elf_so/arch/sparc/Makefile.inc: revision 1.12
usr.bin/ldd/dummy.c: revision 1.1
gnu/usr.bin/binutils/ld/Makefile: revision 1.28
usr.bin/ldd/elf32/Makefile: revision 1.1
usr.bin/ldd/elf32/Makefile: revision 1.2
usr.bin/ldd/ldd.c: revision 1.3
usr.bin/ldd/elf32/Makefile: revision 1.3
usr.bin/ldd/ldd_elf/Makefile: file removal
usr.bin/ldd/ldd.h: revision 1.1
usr.bin/ldd/ldd.c: revision 1.4
usr.bin/ldd/ldd_aout.c: revision 1.1
usr.bin/ldd/Makefile: revision 1.8
usr.bin/ldd/Makefile: revision 1.9
usr.bin/ldd/ldd_elfxx.c: revision 1.1
libexec/ld.elf_so/map_object.c: revision 1.37
usr.bin/ldd/ldd_aout/Makefile: file removal
usr.bin/ldd/elf64/Makefile: revision 1.1
rescue/Makefile: revision 1.22
libexec/ld.elf_so/arch/i386/Makefile.ld32: revision 1.1
usr.bin/ldd/ldd_elf/ldd.c: file removal
usr.bin/ldd/elf64/Makefile: revision 1.2
usr.bin/ldd/elf64/Makefile: revision 1.3
usr.bin/ldd/aout/Makefile: revision 1.1
libexec/ld.elf_so/arch/i386/Makefile.inc: revision 1.12
rescue/list.ldd: revision 1.1
usr.bin/ldd/ldd_elf/README: file removal
usr.bin/ldd/Makefile.common: revision 1.1
move the defines for RTLD_ARCH_SUBDIR into a sub-sub-makefile so we can
grab these values via reach-over more easily.
some fixes for PR#40170:
- set NATIVE=yes in the environment for genscripts.sh
- set LIB_PATH to /usr/lib/{sparc,i386} for those scripts
- set use_sysroot to "yes", to enable LIB_PATH to work in genscripts.sh
- get rid of building an a.out-happy ldd (but keep supporting a.out
binaries for the ELF version.)
- convert a.out, elf32 and elf64 support into convience libraries and
link them right ones in. if elf_ldd() fails on 64 bit platforms,
try elf32_ldd() before aout_ldd().
now ldd on 64 bit platforms works for 32 bit binaries, aka PR#40199,
and it seems that all the issues from README are gone too.
add some (uintptr_t) to some casts, so these compile with ELFSIZE=32
*and _LP64. necessary for 32/64 bit combo ldd support.
- rework this a bunch to make it work inside /rescue/ldd.
- fix alpha build.
make sure we set LIBISPRIVATE.
fixes build issues reported by moof.
make sure we set LIBISPRIVATE.
fixes build issues reported by moof.
 1.2.12.2.4.3  17-Feb-2012  matt Move fmtprint and print_needed since they are dependent on ELFSIZE.
 1.2.12.2.4.2  21-Apr-2010  matt sync to netbsd-5
 1.2.12.2.4.1  23-Dec-2009  mrg pull across from -current:
> Log Message:
> - adjust the logic for compat ldd: add an elf32_compat module and arrange
> for mips64 to build this with MLIBDIR set to o32
> - make mips64 ldd call elf32_compat_ldd as well
> - make mips64 elf64 set MLIBDIR to 64
> - don't need ld.elf_so's Makefile.ld32 files anymore (they are going away
> soon anyway)
>
> tested on amd64 and sparc64, and an earlier version tested on mips64.

> Log Message:
> make this actually build on mips64.
 1.19.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19.4.1  30-Oct-2012  yamt sync with head
 1.20.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.2.1  23-Jun-2013  tls resync from head
 1.27.2.1  12-Jan-2023  martin Pull up following revision(s) (requested by mrg in ticket #41):

usr.bin/ldd/ldd.c: revision 1.28

avoid printing the latest error message if some ldd method worked.

RSS XML Feed