This is the mail archive of the binutils@sources.redhat.com 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: Bug in gas generating sh PIC, or is it me?


I wrote:
> I've fixed it in my local tree and will come up with a patch
> and an appropriate testcase. Thank you for your report.

Here is a patch. I have nothing to say about it anymore because
Alan has explained it already :-)
I've added a testcase to gas/sh/pic.[sd] for it. It is tested on
sh-unknown-linux-gnu. Committed.

Regards,
	kaz
--
gas
	* config/tc-sh.c (md_apply_fix3): Take account of fx_offset
	for BFD_RELOC_32_PLT_PCREL.

gas/testsuite
	* sh/gas/sh/pic.s: Add a test for ".long foo@PLT+.-2-label".
	* sh/gas/sh/pic.d: Add expected output.

diff -u3prN ORIG/src/gas/config/tc-sh.c LOCAL/src/gas/config/tc-sh.c
--- ORIG/src/gas/config/tc-sh.c	Sat Nov 30 21:51:44 2002
+++ LOCAL/src/gas/config/tc-sh.c	Sat Nov 30 21:53:57 2002
@@ -3516,7 +3516,7 @@ md_apply_fix3 (fixP, valP, seg)
       /* Make the jump instruction point to the address of the operand.  At
 	 runtime we merely add the offset to the actual PLT entry.  */
       * valP = 0xfffffffc;
-      val = 0;
+      val = fixP->fx_offset;
       if (fixP->fx_subsy)
 	val -= S_GET_VALUE (fixP->fx_subsy);
       fixP->fx_addnumber = val;
diff -u3prN ORIG/src/gas/testsuite/gas/sh/pic.d LOCAL/src/gas/testsuite/gas/sh/pic.d
--- ORIG/src/gas/testsuite/gas/sh/pic.d	Wed Feb  6 15:18:28 2002
+++ LOCAL/src/gas/testsuite/gas/sh/pic.d	Sat Nov 30 21:53:57 2002
@@ -38,3 +38,6 @@ Disassembly of section \.text:
 0x00000040 00 00       	\.word 0x0000
 			40: R_SH_PLT32	foo
 0x00000042 00 14       	mov\.b	r1,@\(r0,r0\)
+0x00000044 00 00       	\.word 0x0000
+			44: R_SH_PLT32	foo
+0x00000046 00 1e       	mov\.l	@\(r0,r1\),r0
diff -u3prN ORIG/src/gas/testsuite/gas/sh/pic.s LOCAL/src/gas/testsuite/gas/sh/pic.s
--- ORIG/src/gas/testsuite/gas/sh/pic.s	Wed Feb  6 15:18:28 2002
+++ LOCAL/src/gas/testsuite/gas/sh/pic.s	Sat Nov 30 21:53:57 2002
@@ -39,3 +39,5 @@
 	.long	foo@PLT + . - (.LPLTcall_old + 2)
 .Lfooplt_new:
 	.long	foo@PLT - (.LPLTcall_new + 2 - .)
+.Lfooplt_old2:
+	.long	foo@PLT + . - 2 - .LPLTcall_old


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]