This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2 v5] gold: enable new dtags by default


Where did we end up on this issue? As far as I can tell, the
discussion just died with no clear consensus, and I'm still not sure
what changes I should make to gold.

It sounds like the community really isn't ready to move away from
DT_RPATH, but I'm not sure why. As I understand it, there are two
differences between DT_RPATH and DT_RUNPATH:

(1) DT_RUNPATH is searched after LD_LIBRARY_PATH, while DT_RPATH is
searched before. The DT_RUNPATH behavior makes sense to me -- having
an environment variable that can't override the search path embedded
in the binary seems useless.

(2) DT_RUNPATH is used only to search for direct dependencies of the
object it's contained in, while DT_RPATH is used for indirect
dependencies as well. (This difference is *not* mentioned in the
gABI.) Again, the DT_RUNPATH behavior makes sense -- an object
shouldn't have any awareness of its indirect dependencies, which may
change over time.

It seems to me that the cases where DT_RUNPATH causes breakage are
broken as intended, and the second-level libraries that depend on
third-level libraries should have an embedded DT_RUNPATH that says
where to find them. Of course, since they've been working for so long,
we need an option to allow them to continue working, but I don't see
why we shouldn't change the default.

In gold, --enable-new-dtags applies only to DT_RUNPATH vs. DT_RPATH.
We always generate DT_FLAGS, but also DT_TEXTREL and DT_SYMBOLIC when
those bits are set. I have no problem with renaming the option to
--{en,dis}able-dt-runpath.

-cary


On Wed, Feb 20, 2013 at 10:40 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Wednesday 20 February 2013 12:16:51 H.J. Lu wrote:
>> On Tue, Feb 19, 2013 at 10:15 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> > On Tuesday 05 February 2013 00:43:04 Ian Lance Taylor wrote:
>> >> On Mon, Feb 4, 2013 at 5:44 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> >> > This caused:
>> >> >
>> >> > http://www.sourceware.org/bugzilla/show_bug.cgi?id=15098
>> >> >
>> >> > I changed BFD linker not set new dtags with -rpath.
>> >>
>> >> I don't see why that is the right fix.  Since DT_RPATH/DT_RUNPATH are
>> >> only ever set by the linker's -rpath option, it seems like the right
>> >> fix is to always use DT_RPATH and never use DT_RUNPATH.
>> >>
>> >> Of course, since the only thing --new-dtags does in gold is select
>> >> DT_RUNPATH rather than DT_RPATH, this makes new--dtags completely
>> >> useless in gold.
>> >>
>> >> It seems that we have made sensible-seeming decisions to wind up in an
>> >> absurd place.  It seems that we should now make --new-dtags a no-op
>> >> and drop all support for generating DT_RUNPATH.  Which makes me wonder
>> >> why DT_RUNPATH was invented in the first place.
>> >
>> > sorry, but my main comp hd died, so i've been offline for a while.  it
>> > seems that the current status is that the linker no longer defaults to
>> > --enable-new- dtags, but bfd still only specifies DT_RUNPATH if the flag
>> > is enabled (rather than using both).  is that correct ?
>> >
>> > DT_RUNPATH is preferable to DT_RPATH because the latter is searched
>> > *before* LD_LIBRARY_PATH which is bad.  most of the use cases i've seen
>> > with rpath fall
>> >
>> > into two categories:
>> >  - people want to generate libraries with a custom path to loadable
>> >  plugins --
>> >
>> > DT_RUNPATH works great
>> >
>> >  - people want their application to search a local path for all of its
>> >  libs --
>> >
>> > DT_RPATH works here w/$ORIGIN
>> >
>> >  - people want to install their shared libs into a non-searchable path
>> >  and
>> >
>> > have their application use it -- DT_RUNPATH works here
>> >
>> > i've seen build cases where DT_RPATH actively causes problems when there
>> > is a version already installed.  they compile their local binary and its
>> > shared libs, then attempt to use LD_LIBRARY_PATH to force the binary to
>> > use the local libs.  unfortunately, the DT_RPATH kicks in and loads
>> > everything from / instead and it falls down.
>> >
>> > considering Gentoo has been defaulting to --enable-new-dtags since at
>> > least 2004 and i have yet to see a bug report related to it, i wonder
>> > what actually broke that caused you to notice this ?  and if it's a
>> > minor case, is a better answer to tell people to use --disable-new-dtags
>> > if they really don't want the new DT_RUNPATH behavior ?  seems like the
>> > DT_RPATH behavior is the exception rather than the rule ... the only
>> > thing it has going for it is historical precedence.
>> >
>> > similarly, i don't think it generally makes sense for libraries to
>> > utilize DT_RPATH.  dare i suggest that a middle ground might be to
>> > default to DT_RUNPATH when -shared is in use, and DT_RPATH otherwise ?
>>
>> Since DT_RPATH != DT_RUNPATH. we need a new option to
>> specify DT_RUNPATH.
>
> i'm aware "DT_RPATH != DT_RUNPATH" is a true statement.  however, my point
> still stands that for the majority of cases, people want runpath tags to
> specify custom paths for loading libraries and in that regard, DT_RUNPATH is
> the same as DT_RPATH.  imo, the example you posted is the exception rather
> than the rule when it comes to expected behavior and already works w/the
> patches i posted -- if you want that behavior, use -rpath --disable-new-dtags.
> hence the idea is to improve the default rather than requiring everyone to
> change flags.
> -mike


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]