This is the mail archive of the libc-alpha@sources.redhat.com 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: [rfc] anti-plt patch for division routines


On Tue, Jan 25, 2005 at 02:22:29PM -0800, Roland McGrath wrote:
> I guess I don't fully grok what this is all for.  Your earlier message on
> the subject didn't really elucidate the situation and the change you intend
> clearly for an alpha-ignorant person like me.  This seems like a pretty
> hairy approach, so I'd really like to understand the problem being solved.

On alpha, we have no hardware integer division.  Instead, we have 8
routines with very special calling convnetions: __{div,rem}{l,q}{,u}.
These abi for these routines only allow 2 registers to be clobbered.

Which, means, on entry to the dynamic linker, we have to be sure to
save the other 62 - {regular call-saved}, which is about 34 more than
we would have needed to save if we only had to cater to C calling
conventions.

So the object of all this is to (1) change the abi of the dynamic
linker so that we only have to worry about c calling conventions,
(2) arrange for the static linker to never again create a plt for
these special division routines, and (3) handle old binaries in a
way that approaches correct.

(1) and (2) are the easy bits, of course.  For (3), we need to 
figure out when a particular binary *wasn't* linked against something
that handles (2) and so the given binary has (or may have) a plt
entry that resolves to one of these special division routines.

My solution to (3) is to arrange for some .o that must necessarily
be linked with all new binaries to add a PT_NOTE that indicates that
the corresponding libc.so file tells the static linker not to create
a plt entry.  Adding the note to crti.o would seem to accomplish this,
under the assumption that someone doesn't do shit like manage to 
invoke ld by hand and include crti.o, but not libc.so.  But it does
suck to be stupid and those folk get what they deserve.

Alternately, I could admit that plt resolution time is not dominated
by register saves in the trampoline, and live with a bad decision 
made circa 1996.


r~


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