From: Alan Modra Date: Thu, 3 Dec 2009 08:32:06 +0000 (+0000) Subject: PR ld/11047 X-Git-Tag: binutils-2_20_1~130 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc1a7acf3f333b437bd3a946afbe2640c394a82e;p=thirdparty%2Fbinutils-gdb.git PR ld/11047 * elf32-ppc.c (ppc_elf_relocate_section): Delete __tls_get_addr symbol reference from relocs belonging to calls that are optimized away. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index dfedc7304bd..6c671a26218 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2009-12-03 Alan Modra + + PR ld/11047 + * elf32-ppc.c (ppc_elf_relocate_section): Delete __tls_get_addr + symbol reference from relocs belonging to calls that are + optimized away. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + 2009-11-17 Ulrich Weigand * elf32-spu.c (struct spu_link_hash_table): Remove overlay_fixed, diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 95058a233db..aab08be5a53 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -6914,9 +6914,7 @@ ppc_elf_relocate_section (bfd *output_bfd, insn1 |= 32 << 26; /* lwz */ if (offset != (bfd_vma) -1) { - rel[1].r_info - = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), - R_PPC_NONE); + rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE); insn2 = 0x7c631214; /* add 3,3,2 */ bfd_put_32 (output_bfd, insn2, contents + offset); } @@ -6990,8 +6988,7 @@ ppc_elf_relocate_section (bfd *output_bfd, bfd_put_32 (output_bfd, insn2, contents + offset); /* Zap the reloc on the _tls_get_addr call too. */ BFD_ASSERT (offset == rel[1].r_offset); - rel[1].r_info = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), - R_PPC_NONE); + rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE); } break; @@ -7020,8 +7017,7 @@ ppc_elf_relocate_section (bfd *output_bfd, contents + rel->r_offset - d_offset); /* Zap the reloc on the _tls_get_addr call too. */ BFD_ASSERT (rel->r_offset - d_offset == rel[1].r_offset); - rel[1].r_info = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), - R_PPC_NONE); + rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE); rel--; continue; } diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 35757b85d5c..8052c9c08b5 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -11129,8 +11129,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, insn1 |= 58 << 26; /* ld */ insn2 = 0x7c636a14; /* add 3,3,13 */ if (offset != (bfd_vma) -1) - rel[1].r_info = ELF64_R_INFO (ELF64_R_SYM (rel[1].r_info), - R_PPC64_NONE); + rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE); if ((tls_mask & TLS_EXPLICIT) == 0) r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3) + R_PPC64_GOT_TPREL16_DS); @@ -11229,8 +11228,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, rel->r_info = ELF64_R_INFO (r_symndx, r_type); /* Zap the reloc on the _tls_get_addr call too. */ BFD_ASSERT (offset == rel[1].r_offset); - rel[1].r_info = ELF64_R_INFO (ELF64_R_SYM (rel[1].r_info), - R_PPC64_NONE); + rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE); insn3 = bfd_get_32 (output_bfd, contents + offset + 4); if (insn3 == NOP @@ -11275,8 +11273,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, rel->r_offset = offset + d_offset; /* Zap the reloc on the _tls_get_addr call too. */ BFD_ASSERT (offset == rel[1].r_offset); - rel[1].r_info = ELF64_R_INFO (ELF64_R_SYM (rel[1].r_info), - R_PPC64_NONE); + rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE); insn2 = 0x38630000; /* addi 3,3,0 */ insn3 = bfd_get_32 (output_bfd, contents + offset + 4);