This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: Speeding up the dynamic linker with 100s of DSOs?


On Fri, 27 Jan 2006, michael meeks stipulated:
> 
> On Fri, 2006-01-27 at 12:11 +0000, Nix wrote:
>> I think perhaps interposition should be something like PT_GNU_STACK,
>> turnable-on by ELF binaries that explicitly declare that they need it
>> (and when it's turned on it obviously `contaminates' the whole process);
> 
> 	Well - of course, my -Bdirect implementation provides a way to do
> direct (non-interposing) linkage, in a way that honors linking with a
> mix of old & new style libraries, and handles the tricky C++ vague
> linkage issues - so it's nearly what you ask for.

Yes; it seems like a very nifty piece of work to me.

>                                                   Clearly though you
> check for DT_DIRECT rather than the absence of something else. Of course

Absolutely! This isn't like the read-only stack stuff where you had to
assume that the stack was writable if not otherwise specified, to avoid
breaking old stuff: almost nothing relies on symbol interposition, so
it's reasonable to turn it off by default.

(Actually Oracle's precompiler runtime libraries rely on it, but if I
told you what they try to do in regard of `stub libraries' exporting the
same symbols as glibc, you'd be violently ill, so I won't. In any case,
their foul hack doesn't work and is routinely disabled at sites using
said products, so going to any effort to avoid breaking it is futile.)

> on Solaris the (somewhat different) -Bdirect support is there as
> standard & widely used.

Yep, and it hasn't caused the world to end nor people who need
interposition to rise in armed rebellion. A good sign.

>> (Obviously, using LD_PRELOAD would also enable interposition.
> 
> 	Sure - as soon as you LD_PRELOAD we turn all -Bdirect stuff off - of
> course, it'd be trivial to optimize that, but would require some
> re-factoring, that'd look unpleasant in patch form.

I doubt it's *worth* optimizing. Sure, let's avoid slowing it down, but
going to great lengths to speed it up will just encourage people to use
/etc/ld.so.preload or something, and then Ulrich will have an infarction
and it'll all be your fault. :)

I suppose there have been non-debugging uses of it, like that hack which
enabled Xft usage on GNOME 1, but, again, are these significant enough to
complicate already-complex speed-and-correctness-critical code trying to
speed up?

(I've also used it as crude ways to script some non-scriptable programs;
if I wanted something done before the Nth call of some preload-hookable
function... but I think I've done that twice in ten years. It's just
not that significant.)

>> LD_PRELOAD is definitely the instance of interposition that would have
>> people screaming if we took it away, given how many nifty debugging
>> hacks and diagnostic tricks it enables.)
> 
> 	Of course /me uses it himself all the time.

Oh good. I don't have to worry about you breaking the actually *useful*
uses for symbol interposition then :)

-- 
`I won't make a secret of the fact that your statement/question
 sent a wave of shock and horror through us.' --- David Anderson


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