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


Thanks a bunch for the patch Alan!! I really appreciate this help.

On Thu, Jun 18, 2009 at 8:29 PM, Alan Modra<amodra@bigpond.net.au> wrote:
> On Tue, Jun 16, 2009 at 06:30:10PM +0930, Alan Modra wrote:
>> 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 guess there isn't really any need to slavishly follow the ABI for
> PLTREL24 relocs against locals. ?This patch treats such relocs as
> if they were REL24.
>
> ? ? ? ?* elf32-ppc.c (ppc_elf_check_relocs): Allow local symbols for
> ? ? ? ?R_PPC_PLTREL24 relocs.
> ? ? ? ?(ppc_elf_relocate_section): Likewise.
>
> Index: bfd/elf32-ppc.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
> retrieving revision 1.257
> diff -u -p -r1.257 elf32-ppc.c
> --- bfd/elf32-ppc.c ? ? 19 Jun 2009 00:41:28 -0000 ? ? ?1.257
> +++ bfd/elf32-ppc.c ? ? 19 Jun 2009 01:32:27 -0000
> @@ -3570,8 +3570,11 @@ ppc_elf_check_relocs (bfd *abfd,
> ? ? ? ? ? ?h->non_got_ref = TRUE;
> ? ? ? ? ?break;
>
> - ? ? ? case R_PPC_PLT32:
> ? ? ? ?case R_PPC_PLTREL24:
> + ? ? ? ? if (h == NULL)
> + ? ? ? ? ? break;
> + ? ? ? ? /* Fall through */
> + ? ? ? case R_PPC_PLT32:
> ? ? ? ?case R_PPC_PLTREL32:
> ? ? ? ?case R_PPC_PLT16_LO:
> ? ? ? ?case R_PPC_PLT16_HI:
> @@ -7210,6 +7213,8 @@ ppc_elf_relocate_section (bfd *output_bf
> ? ? ? ? ?break;
>
> ? ? ? ?case R_PPC_PLTREL24:
> + ? ? ? ? if (h == NULL)
> + ? ? ? ? ? break;
> ? ? ? ? ?/* Relocation is to the entry for this symbol in the
> ? ? ? ? ? ? procedure linkage table. ?*/
> ? ? ? ? ?{
>
> --
> 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]