[GAS PATCH]: Sparc %pc22/%pc10 test case and bug fix

David Miller davem@davemloft.net
Sun Apr 20 01:22:00 GMT 2008


This adds a test case for %pc22/%pc10 relocation emission
on Sparc, and fixes a bug unearthed by the testcase :-)

Ok to commit?

gas/

2008-04-19  David S. Miller  <davem@davemloft.net>

	* tc-sparc.c (tc_gen_reloc): Accept BFD_RELOC_SPARC_PC22
	and BFD_RELOC_SPARC_PC10.

Index: config/tc-sparc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sparc.c,v
retrieving revision 1.71
diff -u -p -r1.71 tc-sparc.c
--- config/tc-sparc.c	18 Apr 2008 08:47:35 -0000	1.71
+++ config/tc-sparc.c	19 Apr 2008 09:59:38 -0000
@@ -3398,6 +3401,8 @@ tc_gen_reloc (section, fixp)
     case BFD_RELOC_32_PCREL_S2:
     case BFD_RELOC_SPARC13:
     case BFD_RELOC_SPARC22:
+    case BFD_RELOC_SPARC_PC22:
+    case BFD_RELOC_SPARC_PC10:
     case BFD_RELOC_SPARC_BASE13:
     case BFD_RELOC_SPARC_WDISP16:
     case BFD_RELOC_SPARC_WDISP19:

gas/testsuite/

2008-04-19  David S. Miller  <davem@davemloft.net>

	* gas/sparc/pc2210.d: New file.
	* gas/sparc/pc2210.d: Likewise.
	* gas/sparc/sparc.exp: Run new %pc22/%pc10 relocation test.

Index: testsuite/gas/sparc/sparc.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/sparc/sparc.exp,v
retrieving revision 1.13
diff -u -p -r1.13 sparc.exp
--- testsuite/gas/sparc/sparc.exp	16 Apr 2008 08:51:17 -0000	1.13
+++ testsuite/gas/sparc/sparc.exp	19 Apr 2008 09:59:41 -0000
@@ -55,6 +55,7 @@ if [istarget sparc*-*-*] {
     run_dump_test "v9branch3"
     run_dump_test "v9branch4"
     run_dump_test "v9branch5"
+    run_dump_test "pc2210"
 
     run_list_test "pr4587" ""
 }
--- /dev/null	2008-03-03 20:22:44.000000000 -0800
+++ testsuite/gas/sparc/pc2210.d	2008-04-19 02:58:26.000000000 -0700
@@ -0,0 +1,13 @@
+#as: -Av7
+#objdump: -dr
+#name: pc2210
+
+.*: +file format .*sparc.*
+
+Disassembly of section .text:
+
+0+ <.text>:
+   0:	13 00 00 00 	sethi  %hi\(0\), %o1
+			0: R_SPARC_PC22	.data
+   4:	92 12 60 00 	mov  %o1, %o1	! 0 <.text>
+			4: R_SPARC_PC10	.data
--- /dev/null	2008-03-03 20:22:44.000000000 -0800
+++ testsuite/gas/sparc/pc2210.s	2008-04-19 02:56:03.000000000 -0700
@@ -0,0 +1,6 @@
+	# Test R_SPARC_PC22 and R_SPARC_PC10 relocations
+	.data
+sym:	.word	0
+	.text
+	sethi	%pc22(sym), %o1
+	or	%o1, %pc10(sym), %o1



More information about the Binutils mailing list