This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Eliminating PLT calls during linking
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Leonid Romanov <leonidr at creware dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 27 Nov 2002 19:00:08 +0100
- Subject: Re: Eliminating PLT calls during linking
- References: <1038419587.23938.41.camel@mars.creware.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Nov 27, 2002 at 08:53:07PM +0300, Leonid Romanov wrote:
> I'm a little bit tired from reading ELF spec, so please excuse me if my
> question is dumb or doesn't belong there.
> Let's suppose I have two static I386 libraries compiled with -fpic
> option, lib1 and lib2. lib1 has global foo() function which calls extern
> bar() function, and lib2 has that bar() function. Because of PIC code,
> bar() function in lib1 is called via PLT.
> Now, I want to link these two libraries together to produce shared
> library from which I'm going to use only foo() function. But my problem
> is that in resulting shared library bar() function is still called via
> PLT. And I want it to be called via offset from PC, or GOT, or whatever.
> The reason is size. Eliminating PLT entry for bar() will allow me to
> delete its symbol from symbols table, and I have lot of such bar()
> functions in my real libraries (which are C++ methods with long mangled
> names).
> Is it possible? If so, could you point me to right direction? Should I
> look at ld options, or ld scripts, or some object files hacking is
> required?
Use a linker version script (possibly anonymous) to hide foo.
Jakub