Re: [libltdl] removal from gnu ports

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Wed, 7 Jun 2017 14:13:31 +0300
On Wed, Jun 07, 2017 at 11:33:32AM +0100, David Chisnall wrote:
> On 7 Jun 2017, at 10:33, blubee blubeeme <gurenchan_at_gmail.com> wrote:
> > 
> > Hi
> > 
> > I'm sure I was reading yesterday on a different machine about the linker
> > flag -ld which has something to do with gnu dlopen and how it's ok to
> > remove those from your Makefile since FreeBSD handles dlopen and a few
> > other things from that header in the standard libc.
> > 
> > Is that correct?
> 
> Do you mean -ldl?  If so, then yes.  On Linux, the dl* symbols are only exported from ld-linux.so if you link against libdl.  On FreeBSD, they are exported from rtld regardless.

Symbols from the dynamic linker are always exported.

Issue is that the dynamic linker is never specified as the library on
the static linker (ld) command line. Linux puts stabs for the rtld
symbols into libdl.so, while FreeBSD provides weak symbols in the
libc.so dynamic symbol table. As result, FreeBSD does not need -ldl for
access to dl*(3), and does not provide libdl.so.

FreeBSD scheme is problematic because rtld have to prefer non-weak
symbols over weak, to have dynamic binaries to use real rtld symbols and
not libc stubs. It is non-compliant with the ELF spec. Unfortunately,
it is used also in other places, making us stuck with the non-compliant
behaviour.
Received on Wed Jun 07 2017 - 09:13:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:11 UTC