From: Alan Modra Date: Tue, 22 Aug 2006 12:06:10 +0000 (+0000) Subject: * elf32-ppc.c (ppc_elf_relocate_section): Correct GOT and PLT HA X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5c5f6e17d0445d1c67dd8a0a8310231b717e776c;p=binutils-gdb.git * elf32-ppc.c (ppc_elf_relocate_section): Correct GOT and PLT HA reloc handling. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ed9159dc6be..adc0f59e46b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2006-08-22 Alan Modra + + * elf32-ppc.c (ppc_elf_relocate_section): Correct GOT and PLT HA + reloc handling. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + 2006-08-21 Mark Shinwell * elf32-arm.c (elf32_arm_link_hash_table): Correct typo in diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index bc449b3f3ec..6e80a1e29c2 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -6609,25 +6609,28 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_ADDR16_HA: case R_PPC_REL16_HA: - case R_PPC_GOT16_HA: - case R_PPC_PLT16_HA: case R_PPC_SECTOFF_HA: case R_PPC_TPREL16_HA: case R_PPC_DTPREL16_HA: - case R_PPC_GOT_TLSGD16_HA: - case R_PPC_GOT_TLSLD16_HA: - case R_PPC_GOT_TPREL16_HA: - case R_PPC_GOT_DTPREL16_HA: case R_PPC_EMB_NADDR16_HA: case R_PPC_EMB_RELST_HA: /* It's just possible that this symbol is a weak symbol that's not actually defined anywhere. In that case, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ - if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. - Bits 0:15 are not used. */ - addend += 0x8000; + if (sec == NULL) + break; + /* Fall thru */ + + case R_PPC_PLT16_HA: + case R_PPC_GOT16_HA: + case R_PPC_GOT_TLSGD16_HA: + case R_PPC_GOT_TLSLD16_HA: + case R_PPC_GOT_TPREL16_HA: + case R_PPC_GOT_DTPREL16_HA: + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; } diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index de2dd792dff..4fd6bf76319 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -10928,17 +10928,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, case R_PPC64_ADDR16_HA: case R_PPC64_ADDR16_HIGHERA: case R_PPC64_ADDR16_HIGHESTA: - case R_PPC64_GOT16_HA: - case R_PPC64_PLTGOT16_HA: - case R_PPC64_PLT16_HA: case R_PPC64_TOC16_HA: case R_PPC64_SECTOFF_HA: case R_PPC64_TPREL16_HA: case R_PPC64_DTPREL16_HA: - case R_PPC64_GOT_TLSGD16_HA: - case R_PPC64_GOT_TLSLD16_HA: - case R_PPC64_GOT_TPREL16_HA: - case R_PPC64_GOT_DTPREL16_HA: case R_PPC64_TPREL16_HIGHER: case R_PPC64_TPREL16_HIGHERA: case R_PPC64_TPREL16_HIGHEST: @@ -10951,10 +10944,20 @@ ppc64_elf_relocate_section (bfd *output_bfd, that's not actually defined anywhere. In that case, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ - if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. - Bits 0:15 are not used. */ - addend += 0x8000; + if (sec == NULL) + break; + /* Fall thru */ + + case R_PPC64_GOT16_HA: + case R_PPC64_PLTGOT16_HA: + case R_PPC64_PLT16_HA: + case R_PPC64_GOT_TLSGD16_HA: + case R_PPC64_GOT_TLSLD16_HA: + case R_PPC64_GOT_TPREL16_HA: + case R_PPC64_GOT_DTPREL16_HA: + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; case R_PPC64_ADDR16_DS: