This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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] Fix mst_solib_trampoline symbol sections for PLT stubs


On Wed, Oct 31, 2007 at 03:29:53PM +0100, Ulrich Weigand wrote:
> Daniel Jacobowitz:
> 
> > Yes.  But if the address of the function is not taken somewhere in the
> > executable, then the address of the undefined symbol will generally be
> > left at zero.  That should be true most of the time.  So while I don't
> > see anything wrong with your approach here, I'm surprised it fixed the
> > testsuite failures; why do they have non-zero addresses?  If we're
> > taking their addresses in all cases, we need some new tests.
> 
> I think this is because there are function calls from the main
> executable to those functions, and the main executable is not
> compiled with -fPIC.  I understand those references will also 
> cause the undefined symbol to carry the address of the main
> PLT call stub ...

Interesting.  On most platforms, that's not necessary: LD only needs
to set a canonical address in the executable's symtab if the
executable takes the function's address, so this should only happen if
those non-PIC calls were indistinguishable from taking the address.

That's not implemented for PowerPC.  I don't know if it's an ABI
requirement or just a missing optimization.  Search for "st_value = 0"
in elf32-ppc.c versus elf32-i386.c.

So, this won't help everywhere or fix the root cause, but it does seem
like it would work for PowerPC.

-- 
Daniel Jacobowitz
CodeSourcery


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