Commit Graph

140 Commits

Author SHA1 Message Date
mrg eec0208311 avoid printing the latest error message if some ldd method worked. 2023-01-04 03:33:54 +00:00
mrg 1f14fa64aa only try the other methods if the previous ones failed.
fixes problem reported by ryoon@
2022-10-18 19:04:57 +00:00
mrg 83e9310529 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.
2022-10-15 05:55:45 +00:00
mrg d914a3c1b9 remove clause 3 from all my licenses that aren't conflicting with
another copyright claim line.  again.  (i did this in 2008 and then
did not update all of my personal templates.)
2021-12-11 19:24:18 +00:00
martin b065142c9d gcc hates strncpy() 2021-07-23 04:20:05 +00:00
christos c686ebaab6 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.
2021-07-22 17:39:52 +00:00
christos ef96cd7f1c Handle mipsn64 2021-04-25 23:52:59 +00:00
joerg a0e0f8b685 PR 54093: Align static TLS area to max_align_t. 2019-11-04 12:45:10 +00:00
mrg 85f6c4cfe8 don't build ldd64 support if !MKCOMPAT and mips64. 2019-02-04 00:05:20 +00:00
kre 636d0f3dee Fix merge botch 2019-01-27 05:16:55 +00:00
kre 0eb8e4ef15 Fix merge botch 2019-01-27 05:15:42 +00:00
kre 1300bdf616 Fix merge botch 2019-01-27 05:14:45 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
kamil f4a6ea5271 Disable SANITIZER for ldd(1)
These utilities (elf32, elf32_compat, elf64, liblldb) share code with the
ELF dynamic loader that is not being sanitized and its symbols are
installed into sanitized programs (in particular __tls_get_addr()).

Additionally libldd is used in rescue that is not expected to be sanitized
as of today.
2018-06-21 10:41:45 +00:00
maya 47dee010ce 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
2017-12-25 05:08:49 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
christos a80110f6b6 need <sys/stat.h> 2017-01-10 21:08:48 +00:00
christos ffeb8dbf4e Define _KERNTYPES for things that need it. 2016-01-23 21:22:45 +00:00
martin 25ed20a82e Do not set MLIBDIR if MKCOMPAT=no 2015-06-13 20:38:52 +00:00
joerg 9d3b3e9cc5 Fix ldd on LP64 platforms by splitting the symbol versioning stuff for
elf64 as well.
2014-08-28 12:23:29 +00:00
matt b1f346caa8 Use OBJECT_FMTS from <bsd.own.mk> to determine elf32/elf64 needs 2014-03-02 03:55:19 +00:00
christos 28ad8d2d4f include symver.c 2013-05-07 13:00:35 +00:00
matt 1c3095e278 If earm, include from lib/libexecinfo for unwind.h 2013-04-25 07:12:46 +00:00
macallan da8b2f53fd 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.
2013-03-20 15:18:42 +00:00
matt 9a1cb11528 Make sure stuff using Obj_Entry is compiled correctly for ELF32 or ELF64. 2012-07-08 00:53:44 +00:00
matt 02a2e7c81a MIPS uses a variable page size now.
(pulled up from matt-nb5-mips64)
2012-02-17 08:13:18 +00:00
wiz 4cbd24b23f dependant -> dependent 2011-06-30 20:09:15 +00:00
joerg 9a1e56f24b Fix sign compare 2011-05-24 12:27:29 +00:00
plunky d1fbb9e17f move the build of ldd binary to a subdir in order to allow
explict ordering. This makes "make all" work the same as
"make dependall"
2011-04-15 08:47:02 +00:00
joerg 8fa6585514 Block signals when using the exclusive lock. 2011-03-29 20:56:35 +00:00
joerg cb1cd7e860 Add basic locking to ld.elf_so. 2011-03-25 18:07:04 +00:00
joerg aad599979d 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.
2011-03-09 23:10:05 +00:00
skrll e6cdac9c4b Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
2010-10-16 10:27:06 +00:00
roy 9033c3cfe7 Sync against new ld.elf_so 2010-02-27 11:17:05 +00:00
skrll 4931e61023 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.
2010-02-23 08:23:24 +00:00
mrg f4f977dbc5 make this actually build on mips64. 2009-12-15 04:06:43 +00:00
mrg 118cb193d7 - 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.
2009-12-13 08:50:56 +00:00
skrll 77fd7698f3 Make _rtld_pagesz of type size_t.
Fixes round_down for alpha which made ldd(1) break.
2009-11-17 18:44:33 +00:00
wiz 82271cde5a New sentence, new line. 2009-09-07 20:06:21 +00:00
dholland 15a88044ca Add an -o option that behaves like nm -o. Implementation from a suggestion
by jmcneill (thanks!); ok mrg. Closes PR 41994.
2009-09-07 17:56:52 +00:00
dholland 1657935cd2 Sprinkle a little const. no object diffs 2009-09-07 04:49:03 +00:00
wiz 87e1425a46 Add missing word and bump date for previous. 2009-08-23 15:37:39 +00:00
mrg a9208fb155 kill ldd_aout. it didn't work anyway...not since i don't know when. 2009-08-22 06:52:15 +00:00
he 3b9a95def3 Um, the test for mips should use MACHINE_CPU, not MACHINE_ARCH. 2009-08-20 21:07:47 +00:00
he c93d22967f Don't try to call the (no longer defined) aout_ldd() function
if we're building for mips.
2009-08-20 21:06:17 +00:00
he b233b36efa 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.
2009-08-20 19:17:19 +00:00
martin f842f249ac More missing <sys/exec_aout.h> 2009-08-16 18:43:08 +00:00
christos ebd7e1e10a catch up with rtld changes 2009-05-20 16:20:01 +00:00
lukem c1ceae17f0 Enable WARNS=4 by default for usr.bin, except for:
awk  bdes  checknr  compile_et  error  gss  hxtool  kgetcred  kinit
	klist  ldd  less  lex  locale  login  m4  man  menuc  mk_cmds
	mklocale  msgc  openssl  rpcgen  rpcinfo  sdiff  spell  ssh
	string2key  telnet  tn3270  verify_krb5_conf  xlint
2009-04-14 22:15:16 +00:00
abs 515e52158b Convert more MACHINE tests to MACHINE_ARCH 2009-02-14 13:50:50 +00:00