From e1710606c993baab0555429f130bbfd7a2fe3971 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Fri, 17 Mar 2006 06:44:37 +0000 Subject: [PATCH] bfd/ChangeLog: * elf32-ppc.c (ppc_elf_relocate_section): Copy addend from first relocation to the second when relaxing TLS GD to LE; zero it out when relaxing to IE. ld/testsuite/ChangeLog: * ld-powerpc/tls32.s: Verify that +32768 @plt addend is discarded. --- bfd/ChangeLog | 6 ++++++ bfd/elf32-ppc.c | 3 ++- ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-powerpc/tls32.s | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5b8d908621..794f18f122 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2006-03-17 Alexandre Oliva + + * elf32-ppc.c (ppc_elf_relocate_section): Copy addend from + first relocation to the second when relaxing TLS GD to LE; + zero it out when relaxing to IE. + 2006-03-17 Alan Modra PR 2434 diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 2fd30a0560..6a2d5170d7 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -5768,6 +5768,7 @@ ppc_elf_relocate_section (bfd *output_bfd, insn1 |= 32 << 26; /* lwz */ insn2 = 0x7c631214; /* add 3,3,2 */ rel[1].r_info = ELF32_R_INFO (r_symndx2, R_PPC_NONE); + rel[1].r_addend = 0; r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3) + R_PPC_GOT_TPREL16); rel->r_info = ELF32_R_INFO (r_symndx, r_type); @@ -5782,13 +5783,13 @@ ppc_elf_relocate_section (bfd *output_bfd, /* Was an LD reloc. */ r_symndx = 0; rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; - rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; } r_type = R_PPC_TPREL16_HA; rel->r_info = ELF32_R_INFO (r_symndx, r_type); rel[1].r_info = ELF32_R_INFO (r_symndx, R_PPC_TPREL16_LO); rel[1].r_offset += 2; + rel[1].r_addend = rel->r_addend; } bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); bfd_put_32 (output_bfd, insn2, contents + offset); diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index a9f13571d6..f968b4ce17 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-03-17 Alexandre Oliva + + * ld-powerpc/tls32.s: Verify that +32768 @plt addend is + discarded. + 2006-03-14 Richard Sandiford * ld-mips/emit-relocs-1a.s, ld-mips/emit-relocs-1b.s, diff --git a/ld/testsuite/ld-powerpc/tls32.s b/ld/testsuite/ld-powerpc/tls32.s index b8d0e3d11c..1c3092d5d2 100644 --- a/ld/testsuite/ld-powerpc/tls32.s +++ b/ld/testsuite/ld-powerpc/tls32.s @@ -33,11 +33,11 @@ _start: #global syms #GD addi 3,31,gd0@got@tlsgd #R_PPC_GOT_TLSGD16 gd0 - bl __tls_get_addr@plt #R_PPC_PLTREL24 __tls_get_addr + bl __tls_get_addr+0x8000@plt #R_PPC_PLTREL24 __tls_get_addr #LD addi 3,31,ld0@got@tlsld #R_PPC_GOT_TLSLD16 ld0 - bl __tls_get_addr@plt #R_PPC_PLTREL24 __tls_get_addr + bl __tls_get_addr+0x8000@plt #R_PPC_PLTREL24 __tls_get_addr addi 9,3,ld0@dtprel #R_PPC_DTPREL16 ld0