* i386 ELF PIC PLT optimization ?
@ 2003-01-16 13:36 Fabrice Bellard
0 siblings, 0 replies; only message in thread
From: Fabrice Bellard @ 2003-01-16 13:36 UTC (permalink / raw)
To: gcc
Hi,
Did anybody try to improve the i386 ELF ABI for PIC code ? By looking at
how the thinks are handled on PowerPC, I think that several improvements
are possible, for both smaller and faster code :
1) On i386, the PLT is built by the static linker whereas on PPC it is
built dynamically by the dynamic linker. The net result is that the
executables are smaller and that indirect jumps can be avoided in the
PLT, so the inter DLL/EXEs calls are faster. The PLT can be also smaller
because only 5 (or 8) bytes per entry could be used (a call opcode can
be used for lazy binding and a direct jmp after).
2) On i386, it is almost always needed to initialize %ebx properly to
the GOT address when entering a DLL function (except for functions
calling only static functions and referencing no global variables). On
PPC, it is only needed to initialize %r30 when accessing global variables.
By using a dynamically generated PLT on i386, we could avoid the %ebx
register usage when calling a function by the PLT and so we would need
to initialize %ebx only in rare cases (only if the function accesses
global variables).
The net result would be smaller code (because no function prologue in
most cases) and faster DLL function calls (no indirect jmp and in most
cases %ebx will be usable in the function).
I am thinking about implementing it in TinyCC (a tiny C compiler) to
test it. Does anyone have implemented similar ideas in GCC ? Of course,
a small patch in ld.so would be needed to support that while staying
compatible with standard DLLs.
Fabrice.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-01-16 10:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-16 13:36 i386 ELF PIC PLT optimization ? Fabrice Bellard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).