This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: reloc against local symbol


On Mon, Jun 15, 2009 at 11:03:45PM -0700, Jalaja Dx wrote:
> Why only with Powerpc binutils, this problem is seen whereas if I use
> X86/MIPS, I do not see this problem..

It is a consequence of ld following the PowerPC ABI.  The ABI was
written with 3 different pc-relative 24-bit branch relocations:
R_PPC_PLTREL24, R_PPC_REL24, and R_PPC_LOCAL24PC.  R_PPC_PLTREL24
explicitly says to create a PLT entry and relocate to the PLT.
R_PPC_REL24 relocates to the symbol, but in an executable may
create a PLT entry.  R_PPC_LOCAL24PC always relocates to a symbol
defined in the object.

x86 has two pc-relative relocations for branches, very similar to the
first two PowerPC relocations, R_386_PLT32 and R_386_PC32.  However,
ld ignores the i386 ABI if the R_386_PLT32 symbol is local, and treats
the relocation as if it were R_386_PC32.  It is this bug (feature!)
that allows you to do the rather questionable localization of symbols.

I don't know about MIPS but I suspect the same holds there.

-- 
Alan Modra
Australia Development Lab, IBM


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