Bug of gas (binutils-2.9.1.0.23): Wrong code for SETHI on SPARC

H.J. Lu hjl@lucon.org
Fri Apr 2 17:27:00 GMT 1999


>    Let me know what you get.
> 
>    Thanks.
> 
> 
>    H.J.
>    ---
>    Fri Apr  2 16:05:25 1999  H.J. Lu  (hjl@gnu.org)
> 
> 	   * sparc-opc.c: Change "sethi" from "h,d" to "n,d".
> 
> I don't think that can be right.  I think it will do the wrong thing
> for
>     sethi foo,%i0
> 
 
First, the current gas handles

	sethi foo,%i0

differently than Solaris' as. Solaris' as generates R_SPARC_22. But gas
generates R_SPARC_HI22. The patch enclosed here makes gas matches
Solaris' as. But I don't know if it is correct :-).

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Index: gas/ChangeLog.linux
===================================================================
RCS file: /local/work/cvs/gnu/binutils/gas/ChangeLog.linux,v
retrieving revision 1.62
diff -u -p -r1.62 ChangeLog.linux
--- gas/ChangeLog.linux	1999/03/31 18:21:59	1.62
+++ gas/ChangeLog.linux	1999/04/03 01:22:45
@@ -1,3 +1,7 @@
+Fri Apr  2 17:22:33 1999  H.J. Lu  (hjl@gnu.org)
+
+	* config/tc-sparc.c (tc_gen_reloc): Handle BFD_RELOC_SPARC22.
+
 Sun Mar 28 15:32:42 1999  H.J. Lu  (hjl@gnu.org)
 
 	* Makefile.in: Regenerated with automake 1.4.
Index: gas/config/tc-sparc.c
===================================================================
RCS file: /local/work/cvs/gnu/binutils/gas/config/tc-sparc.c,v
retrieving revision 1.10
diff -u -p -r1.10 tc-sparc.c
--- gas/config/tc-sparc.c	1999/03/31 17:24:48	1.10
+++ gas/config/tc-sparc.c	1999/04/03 01:05:44
@@ -2721,6 +2721,7 @@ tc_gen_reloc (section, fixp)
     case BFD_RELOC_LO10:
     case BFD_RELOC_32_PCREL_S2:
     case BFD_RELOC_SPARC13:
+    case BFD_RELOC_SPARC22:
     case BFD_RELOC_SPARC_BASE13:
     case BFD_RELOC_SPARC_WDISP16:
     case BFD_RELOC_SPARC_WDISP19:
Index: opcodes/ChangeLog.linux
===================================================================
RCS file: /local/work/cvs/gnu/binutils/opcodes/ChangeLog.linux,v
retrieving revision 1.40
diff -u -p -r1.40 ChangeLog.linux
--- opcodes/ChangeLog.linux	1999/03/31 17:24:49	1.40
+++ opcodes/ChangeLog.linux	1999/04/03 01:07:01
@@ -1,3 +1,7 @@
+Fri Apr  2 16:05:25 1999  H.J. Lu  (hjl@gnu.org)
+
+	* sparc-opc.c: Change "sethi" from "h,d" to "n,d".
+
 Sun Mar 28 11:48:17 1999  H.J. Lu  (hjl@gnu.org)
 
 	* i386-dis.c (INSN_FWAIT): New, defined.
Index: opcodes/sparc-opc.c
===================================================================
RCS file: /local/work/cvs/gnu/binutils/opcodes/sparc-opc.c,v
retrieving revision 1.7
diff -u -p -r1.7 sparc-opc.c
--- opcodes/sparc-opc.c	1998/12/05 03:38:56	1.7
+++ opcodes/sparc-opc.c	1999/04/03 01:06:34
@@ -1379,7 +1379,7 @@ CONDFC  ("fbule", "cb013", 0xe, 0),
 { "setsw",	F2(0x0, 0x4), F2(~0x0, ~0x4), "Sh,d", F_ALIAS, v9 },
 { "setx",	F2(0x0, 0x4), F2(~0x0, ~0x4), "S0,1,d", F_ALIAS, v9 },
 
-{ "sethi",	F2(0x0, 0x4), F2(~0x0, ~0x4), "h,d", 0, v6 },
+{ "sethi",	F2(0x0, 0x4), F2(~0x0, ~0x4), "n,d", 0, v6 },
 
 { "taddcc",	F3(2, 0x20, 0), F3(~2, ~0x20, ~0)|ASI(~0),	"1,2,d", 0, v6 },
 { "taddcc",	F3(2, 0x20, 1), F3(~2, ~0x20, ~1),		"1,i,d", 0, v6 },



More information about the Gas2 mailing list