aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/ldd/ldd.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r326276:Eitan Adler2018-03-051-1/+3
| | | | | | | | | | | | | | | | | | | various: general adoption of SPDX licensing ID tags. Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/stable/11/; revision=330449
* Increase size of argv[] array to avoid running off the end.Don Lewis2016-05-161-1/+1
| | | | | | | | | Reported by: Coverity CID: 1193819 MFC after: 1 week Notes: svn path=/head/; revision=299952
* We don't support a.out executables on RISC-V.Ruslan Bukin2016-01-241-2/+2
| | | | | | | | | | Reviewed by: emaste Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D5048 Notes: svn path=/head/; revision=294665
* Add support for ARM EABI.Jung-uk Kim2015-10-161-1/+12
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=289425
* Allowus to exclude a.out support from ldd and use it with arm64 as it won'tAndrew Turner2015-03-181-1/+10
| | | | | | | | | | support the a.out format. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=280220
* Pass variables prefixed with both LD_ and LD_32_ to the run-time linker.Mark Johnston2013-08-071-13/+17
| | | | | | | | | | | | | This prevents unintentional execution of programs when running ldd(1) on 32-bit Linux binaries. PR: 175339, 127276 Suggested by: kib, rstone Reviewed by: kib MFC after: 2 weeks Notes: svn path=/head/; revision=254018
* hdr.elf.e_ident[EI_OSABI] is not a bitmask so '==' should been used.Rebecca Cran2010-11-221-2/+2
| | | | | | | Reported by: Artem Belevich <fbsdlist at src.cx> Notes: svn path=/head/; revision=215705
* A few style and whitespace fixes.John Baldwin2008-08-021-11/+9
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=181161
* Tweak the support for using ldd on 32-bit objects a bit further.John Baldwin2008-08-011-31/+66
| | | | | | | | | | | | | | | | Specifically, build a 32-bit /usr/bin/ldd32 on amd64 which handles 32-bit objects. Since it is a 32-bit binary, it can fork a child process which can dlopen() a 32-bit shared library. The current 32-bit support in ldd can't do this because it does the dlopen() from a 64-bit process. In order to preserve an intuitive interface for users, the ldd binary automatically execs /usr/bin/ldd32 for 32-bit objects. The end result is that ldd on amd64 now transparently handles 32-bit shared libraries in addition to 32-bit binaries. Submitted by: ps (indirectly) Notes: svn path=/head/; revision=181136
* Fix text in the comment why we check for ELF32_R_TYPEEdwin Groothuis2008-07-281-8/+5
| | | | | | | | Approved by: bde@ MFC after: 2 days2 days Notes: svn path=/head/; revision=180877
* After the commit of SVN rev 180236, wilko@ noticed that the approachEdwin Groothuis2008-07-211-4/+18
| | | | | | | | | | | | doesn't work on the Alpha platform: machine/elf.h doesn't include sys/elf32.h there. PR: related to bin/124906 Approved by: bde@ MFC after: 1 week Notes: svn path=/head/; revision=180646
* On 64 bit architectures, you can run 32 bit executables and the rtld can ↵Edwin Groothuis2008-07-031-2/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trace them, but ldd(1) doesn't know yet how to detect them: [/] root@ed-exigent>ldd `which httpd` ldd: /usr/local/sbin/httpd: can't read program header ldd: /usr/local/sbin/httpd: not a dynamic executable But... [/] root@ed-exigent>LD_32_TRACE_LOADED_OBJECTS==1 `which httpd` libm.so.4 => /lib32//libm.so.4 (0x280c8000) libaprutil-1.so.2 => /usr/local/lib/libaprutil-1.so.2 (0x280de000) libexpat.so.6 => /usr/local/lib/libexpat.so.6 (0x280f2000) libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x28110000) libapr-1.so.2 => /usr/local/lib/libapr-1.so.2 (0x281fd000) libcrypt.so.3 => /lib32//libcrypt.so.3 (0x2821d000) libpthread.so.2 => not found (0x0) libc.so.6 => /lib32//libc.so.6 (0x28235000) libpthread.so.2 => /usr/lib32/libpthread.so.2 (0x2830d000) Added support in ldd(1) for the LD_32_xxx environment variables if the architecture of the machine is >32 bits. If we ever go to 128 bit architectures this excercise will have to be repeated but thanks to earlier commits today it will be relative simple. PR: bin/124906 Submitted by: edwin Approved by: bde (mentor) MFC after: 1 week Notes: svn path=/head/; revision=180236
* Extract the determination of the kind of (dynamic) executable fromEdwin Groothuis2008-07-031-81/+120
| | | | | | | | | | | | | the main-loop into a seperate function. Instead of using hardcoded environment variables, define them in a lookup table. For the rest, no functionality changes. Approved by: bde (mentor) MFC after: 1 week Notes: svn path=/head/; revision=180235
* stylify ldd.c, no functional changes.Edwin Groothuis2008-07-031-37/+34
| | | | | | | | Approved by: bde (mentor) MFC after: 1 week Notes: svn path=/head/; revision=180234
* Fix a problem with RTLD_TRACE flag to dlopen(3), which sometimes can returnMaxim Sobolev2002-10-191-5/+4
| | | | | | | | | | | | | | | | even if there was no error occured (when trying to dlopen(3) object that already linked into executable which does dlopen(3) call). This is more proper fix for `ldd /usr/lib/libc.so' problem, because the new behaviour conforms to documentation. Remove workaround from ldd.c (rev.1.32). PR: 35099 Submitted by: Nathan Hawkins <utsl@quic.net> MFC after: 1 week Notes: svn path=/head/; revision=105439
* Fix a tiny bug in shlib support of ldd(1); if dlopen(lib, RTLD_TRACE)Akinori MUSHA2002-05-171-4/+5
| | | | | | | | | | | | | | | | | returns, exit gracefully with 0. This fixes the behavior you see when you specify libc.so. It occurs because ldd(1) itself is linked with libc.so. $ ldd /usr/lib/libc.so /usr/lib/libc.so: ldd: /usr/lib/libc.so: (null) /usr/lib/libc.so: exit status 1 Reviewed by: silence of audit@ Notes: svn path=/head/; revision=96818
* Warns; ANSIfy, constify and move declarations into a common header.Mark Murray2002-04-281-13/+11
| | | | Notes: svn path=/head/; revision=95648
* Include <arpa/inet.h> for prototype of ntohl() used in the N_BADMAG()Mike Barcroft2002-04-201-0/+1
| | | | | | | macro. Notes: svn path=/head/; revision=95153
* remove __PWarner Losh2002-03-221-1/+1
| | | | Notes: svn path=/head/; revision=92920
* Add support such that if LD_TRACE_LOADED_OBJECTS_ALL is defined to aDavid E. O'Brien2002-02-171-5/+11
| | | | | | | | | | | non-empty string in the environment; we indicate which objects caused each object to be loaded. PR: 30908 Submitted-by: Mike Meyer <mwm@mired.org> Notes: svn path=/head/; revision=90755
* Inspect ELF header and reject any non-FreeBSD shared objects.Maxim Sobolev2002-02-081-1/+7
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=90385
* Allow ldd(1) be used on shared libraries in addition to executables.Maxim Sobolev2002-02-041-2/+12
| | | | Notes: svn path=/head/; revision=90172
* GC meaningless assignment.Maxim Sobolev2002-02-041-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=90171
* Fix the type of the NULL arg to execl()Brian Somers2001-07-091-1/+1
| | | | | | | Idea from: Theo de Raadt <deraadt@openbsd.org> Notes: svn path=/head/; revision=79452
* * include/elf.h has been repo copied to include/elf-hints.h, and it noDavid E. O'Brien2001-05-021-1/+1
| | | | | | | | | | | longer includes machine/elf.h. * consumers of elf.h now use the minimalist elf header possible. This change is motivated by Binutils 2.11.0 and too much clashing over our base elf headers and the Binutils elf headers. Notes: svn path=/head/; revision=76224
* Fix lseek args order (PR 23549)Andrey A. Chernov2000-12-151-12/+15
| | | | | | | | | | | Catch and report lseek errors too While reading header don't attempt to continue reading if some IO operation fails PR: 23549 Notes: svn path=/head/; revision=70049
* Add rcsid. Remove unused #include. Remove error() definition and replacePhilippe Charnier2000-12-101-10/+7
| | | | | | | with warn(). Notes: svn path=/head/; revision=69827
* getopt and friends are declared in <unistd.h>Warner Losh2000-09-041-1/+1
| | | | | | | getopt returns -1 not EOF. Notes: svn path=/head/; revision=65428
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Make ldd work on alpha.Doug Rabson1998-09-161-4/+6
| | | | Notes: svn path=/head/; revision=39354
* Fix a bug which caused ldd to execute scripts listed on its commandJohn Polstra1998-08-301-29/+28
| | | | | | | | | | | line, instead of skipping them. Also make a few minor cleanups. PR: bin/7783 Notes: svn path=/head/; revision=38648
* Add ELF support.Doug Rabson1998-05-011-9/+52
| | | | Notes: svn path=/head/; revision=35575
* Touch up the code that implements "ldd -v".John Polstra1997-09-021-2/+2
| | | | | | | | | | Bring the style of sods.c into better conformance. Add code to print the contents of each datum being relocated. Correct the logic that distinguishes between programs, shared libraries, and object files. Make the entire program "-Wall" clean. Notes: svn path=/head/; revision=29042
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22996
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Set LD_TRACE_LOADED_OBJECTS to "1" instead of to "". The dynamic linkerJohn Polstra1997-01-121-2/+2
| | | | | | | | now treats empty "LD_*" environment variables as if they were unset, per the standard SVR4 conventions. Notes: svn path=/head/; revision=21576
* Made the synopsis in the man page conform to the style guide.Bruce Evans1996-11-301-6/+2
| | | | | | | | | Made the usage message conform to the style guide. Don't use the implementation variable `__progname'. Notes: svn path=/head/; revision=20050
* make the Usage string match realityPeter Wemm1996-11-221-2/+4
| | | | | | | Submitted by: faried nawaz <fn@uidaho.edu>, PR#2075 Notes: svn path=/head/; revision=19926
* oops, uninitialised variable.. -v mode depended on stack contents.Peter Wemm1996-10-291-2/+2
| | | | | | | Submitted by: Masafumi NAKANE <max@wide.ad.jp>, PR#1920 Notes: svn path=/head/; revision=19253
* Incorporate John Polstra's sods.c display of the details about thePeter Wemm1996-10-011-2/+18
| | | | | | | | dynamic linking information in the executable. It's quite extensive. It's connected to ldd's (new) -v option. Notes: svn path=/head/; revision=18600
* Support for specifying printf-like output specs to control the ldd outputPeter Wemm1996-10-011-3/+20
| | | | | | | | | | as present in the new rtld version. Obtained from: NetBSD Reviewed by: nate, jdp Notes: svn path=/head/; revision=18598
* Updated to recent version of Paul K.'s shlib code. This code has betterNate Williams1994-12-231-4/+7
| | | | | | | | | | | | | warning handling and allows for link-time warnings with a modified version of gas. Note: Not all of the newer bits were updated such as some of the non-x86 machine-dependant code is relevant to FreeBSD right now. Obtained from: NetBSD Notes: svn path=/head/; revision=5205
* Changes from Paul Kranenburg which bring us into sync with his sources:Rich Murphey1994-06-151-30/+26
| | | | | | | | | | | | | | | | | handling of errors through the standard err() and warn() more fixes for Geoff Rehmet's NULL pointer bug. fixes NULL pointer bugs when linking mono and nested X servers. supports a `-nostdlib' option. accept object files without a symbol table don't attempt dynamic linking when `-A' is given a few variable names have chaged (desc -> fd), and the formatting has changed which should make it much easier to track his sources. I tested 'make world' for /usr/src and X twice with these changes. Notes: svn path=/head/; revision=1741
* This is Paul K's latest set of ld changes. A commit was necessary at thisJordan K. Hubbard1994-02-131-2/+3
| | | | | | | | | | | | | late stage due to the fact that link.h was copyright Sun Microsystems. This version of ld sync's us up with NetBSD's ld and supports compatablily with NetBSD's -[zZ] flags (which we had reversed). Compiling with this new ld will give you RRS warnings for libraries which do not contain .type infomation - these wsarnings are harmless and will go away as soon as you recompile your libraries (cd /usr/src; make libraries). Notes: svn path=/head/; revision=1153
* Imported NetBSD's ld for shared libs.Paul Richards1993-11-031-0/+139
Notes: svn path=/head/; revision=696