RFC: Documenting Linux specific behaviour of --rpath and --rpath-link

Hans-Peter Nilsson hp@bitrange.com
Sat Apr 10 09:42:16 GMT 2021


On Fri, 9 Apr 2021, Fangrui Song wrote:
> On 2021-04-09, Hans-Peter Nilsson wrote:
> > On Wed, 7 Apr 2021, Nick Clifton via Binutils wrote:
> > >   [Begin new text]
> > >
> > >      Note however on Linux based systems there is an additional caveat:
> > >      If the '--as-needed' option is active _and_ a shared library is
> > >      located which would normally satisfy the search _and_ this library
> > >      does not have DT_NEEDED tag for 'libc.so' _and_ there is a shared
> > >      library later on in the set of search directories which also
> > >      satisfies the search _and_ this second shared library does have a
> > >      DT_NEEDED tag for 'libc.so' _then_ the second library will be
> > >      selected instead of the first.
> > >
> > >   [End new text]
> > >
> > >
> > > I thought about trying to add an explanation of why this behaviour is
> > > mandated, but I felt that I was getting out of my depth at that point.
> >
> > Swimming or diving or asking for sufficient assistance is not an
> > option?  1/2 :)
> >
> > > So - does anyone have any comment or corrections for this new text ?
> >
> > This looks sufficiently weird that someone's insanity is in
> > question.  Is it me?  Isn't it actually a bug swept under the
> > rug because of "compability"?
> >
> > brgds, H-P
>
> The long conjunction clauses ... do make it feel like a weird
> compatibility workaround which should be dropped somehow..
>
> In gold and ld.lld, -rpath-link is simply ignored.

I hope you don't mean that last sentence literally, because that
sounds like a separate bug, but a more trivial one: you'd just
not see some DSOs when linking.

brgds, H-P


More information about the Binutils mailing list