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 spake:
> On Thu, 2006-01-26 at 14:43 -0800, Andrew Chatham wrote:
>>  Even at 5% of the previous time, they're still slow. So
>> I may try your patches at some point, though I'm having enough trouble
>> getting this through at the moment.
> 
> 	Sure - so, you really need to re-compile glibc with -Wl,-hashvals, but
> *not* -Wl,-Bdirect; and compile libstdc++ with -Wl,-Bdirect to see a
> non-trivial win.
> 
> 	Interestingly glibc itself (wrt. -lpthread) is the -only- valid/useful
> instance of interposing my 'finterpose' tool detects on my system [ only
> comparing all DSOs so far ].

Interposing via LD_PRELOAD is more common. dmalloc could work that way
(but doesn't).

>                  ELF's/Interposing looks to me like an difficult to
> justify nightmare - used deliberately only in 1 instance, but used in
> error in many others causing unexpected behavior.

Symbol interposition is a lovely *idea* if you have a library with a
strict ABI and want to alter its behaviour from other libraries.

However those other libraries had better be closely tied to the first
library, or the first library had better be designed for interposition
(as glibc is), or the interposition will just confuse the first library,
or at least gain brittle dependencies on exactly what the functions you
are interposing happen to do; and if the first library is designed for
it, it can generally use an application-level fix like callbacks or
something of that nature. And it has horrible consequences for
performance and definite negative consequences for reliability, as you
note.

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);
I'd expect the vast number of binaries to not declare anything of the
kind. (Obviously, using LD_PRELOAD would also enable interposition.
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.)

But alas that's not how ELF works...

-- 
`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]