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]

Power7 thread-safe plt call stubs


We normally have call stubs before glink code so I hadn't seen this
obvious bug, but apparently this can occur in a glibc build.  Adding a
negative offset carries over from the insn branch offset field to the
opcode..

	* elf64-ppc.c (build_plt_stub): Correct plt stub branch to glink.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.400
diff -u -p -r1.400 elf64-ppc.c
--- bfd/elf64-ppc.c	28 Jan 2013 12:30:17 -0000	1.400
+++ bfd/elf64-ppc.c	30 Jan 2013 22:23:06 -0000
@@ -9772,7 +9772,7 @@ build_plt_stub (struct ppc_link_hash_tab
     {
       bfd_put_32 (obfd, CMPLDI_R2_0, p),			p += 4;
       bfd_put_32 (obfd, BNECTR_P4, p),				p += 4;
-      bfd_put_32 (obfd, B_DOT + cmp_branch_off, p),		p += 4;
+      bfd_put_32 (obfd, B_DOT | (cmp_branch_off & 0x3fffffc), p), p += 4;
     }
   else
     bfd_put_32 (obfd, BCTR, p),					p += 4;

-- 
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]