On 6/13/20 11:21 AM, Konstantin Belousov wrote: > Author: kib > Date: Sat Jun 13 18:21:31 2020 > New Revision: 362152 > URL: https://svnweb.freebsd.org/changeset/base/362152 > > Log: > 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.
Hmmm, I have an alternate patch for this that instead depends on the present of PT_INTERP (since we already look at program headers) to determine PIE vs not-PIE. This has the advantage of working for older binaries since DF_1_PIE is relatively recent. (I had also changed it to use libelf to reduce code duplication for the 32-bit compat stuff, but it was pending on getting the branding sorted out since it still doesn't fully work for RISC-V and aarch64 shared libraries until they are branded as the patches also look at notes sections to check for the FreeBSD ABI note tag to decide if a shared library is a FreeBSD one that can be passed to dlopen()). -- John Baldwin _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"