freebsd-dev/usr.bin/ldd
Konstantin Belousov 2b5d88fdcf Fix ldd for PIE binaries after rtld stopped accepting binaries for dlopen.
ldd proclaims ET_DYN objects as shared libraries and tries to
dlopen(RTLD_TRACE) them to get dependencies. Since PIE binaries are
ET_DYN | DF_1_PIE, refusal to dlopen such binaries breaks ldd.

Fix it by reading and parsing dynamic segment looking for DF_FLAG_1
and taking DF_1_PIE into account when deciding between binary and
library.

Reported by:	Dewayne Geraghty <dewayne@heuristicsystems.com.au>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25257
2020-06-13 18:21:31 +00:00
..
extern.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
ldd.1 Add an IMPLEMENTATION NOTES section to ldd.1. 2018-10-23 13:49:53 +00:00
ldd.c Fix ldd for PIE binaries after rtld stopped accepting binaries for dlopen. 2020-06-13 18:21:31 +00:00
Makefile
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
sods.c ldd: reference readelf instead of objdump in warning message 2018-06-15 16:28:50 +00:00