[rx] use OP_NEG instead of RH_NEG32

DJ Delorie dj@redhat.com
Wed Jan 5 22:04:00 GMT 2011


The RH_NEG32 reloc is non-standard.  This patch tells gas to emit the
standard OPneg expression instead.  Applied.

	* reloc.c: Add BFD_RELOC_RX_OP_NEG.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
	* elf32-rx.c: Add it to the list, corresponding to R_RX_OPneg.

	* config/tc-rx.c (tc_gen_reloc): Emit an RX_OP_NEG expression
	instead of an RH_NEG32 one.

Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.526
diff -p -U3 -r1.526  bfd/bfd-in2.h
--- bfd/bfd-in2.h	31 Dec 2010 00:33:31 -0000	1.526
+++ bfd/bfd-in2.h	5 Jan 2011 21:59:33 -0000
@@ -3991,6 +3991,7 @@ instructions  */
   BFD_RELOC_RX_GPRELL,
   BFD_RELOC_RX_SYM,
   BFD_RELOC_RX_OP_SUBTRACT,
+  BFD_RELOC_RX_OP_NEG,
   BFD_RELOC_RX_ABS8,
   BFD_RELOC_RX_ABS16,
   BFD_RELOC_RX_ABS16_REV,
Index: bfd/elf32-rx.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-rx.c,v
retrieving revision 1.6
diff -p -U3 -r1.6  bfd/elf32-rx.c
--- bfd/elf32-rx.c	17 Dec 2010 04:16:56 -0000	1.6
+++ bfd/elf32-rx.c	5 Jan 2011 21:59:33 -0000
@@ -248,6 +248,7 @@ static const struct rx_reloc_map rx_relo
   { BFD_RELOC_RX_RELAX,		R_RX_RH_RELAX },
   { BFD_RELOC_RX_SYM,		R_RX_SYM },
   { BFD_RELOC_RX_OP_SUBTRACT,	R_RX_OPsub },
+  { BFD_RELOC_RX_OP_NEG,	R_RX_OPneg },
   { BFD_RELOC_RX_ABS8,		R_RX_ABS8 },
   { BFD_RELOC_RX_ABS16,		R_RX_ABS16 },
   { BFD_RELOC_RX_ABS16_REV,	R_RX_ABS16_REV },
Index: bfd/libbfd.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.h,v
retrieving revision 1.244
diff -p -U3 -r1.244  bfd/libbfd.h
--- bfd/libbfd.h	17 Dec 2010 04:16:56 -0000	1.244
+++ bfd/libbfd.h	5 Jan 2011 21:59:33 -0000
@@ -1800,6 +1800,7 @@ static const char *const bfd_reloc_code_
   "BFD_RELOC_RX_GPRELL",
   "BFD_RELOC_RX_SYM",
   "BFD_RELOC_RX_OP_SUBTRACT",
+  "BFD_RELOC_RX_OP_NEG",
   "BFD_RELOC_RX_ABS8",
   "BFD_RELOC_RX_ABS16",
   "BFD_RELOC_RX_ABS16_REV",
Index: bfd/reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.209
diff -p -U3 -r1.209  bfd/reloc.c
--- bfd/reloc.c	17 Dec 2010 04:16:56 -0000	1.209
+++ bfd/reloc.c	5 Jan 2011 21:59:33 -0000
@@ -4258,6 +4258,8 @@ ENUMX
 ENUMX
   BFD_RELOC_RX_OP_SUBTRACT
 ENUMX
+  BFD_RELOC_RX_OP_NEG
+ENUMX
   BFD_RELOC_RX_ABS8
 ENUMX
   BFD_RELOC_RX_ABS16
Index: gas/config/tc-rx.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-rx.c,v
retrieving revision 1.6
diff -p -U3 -r1.6  gas/config/tc-rx.c
--- gas/config/tc-rx.c	17 Dec 2010 04:17:00 -0000	1.6
+++ gas/config/tc-rx.c	5 Jan 2011 21:59:33 -0000
@@ -2405,6 +2405,24 @@ tc_gen_reloc (asection * seg ATTRIBUTE_U
       reloc[4] = NULL;
       break;
 
+    case BFD_RELOC_RX_NEG32:
+      reloc[0]->howto         = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+
+      reloc[1]		    = (arelent *) xmalloc (sizeof (arelent));
+      reloc[1]->howto       = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_NEG);
+      reloc[1]->addend      = 0;
+      reloc[1]->sym_ptr_ptr = reloc[0]->sym_ptr_ptr;
+      reloc[1]->address     = fixp->fx_frag->fr_address + fixp->fx_where;
+
+      reloc[2]		    = (arelent *) xmalloc (sizeof (arelent));
+      reloc[2]->howto       = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
+      reloc[2]->addend      = 0;
+      reloc[2]->sym_ptr_ptr = reloc[0]->sym_ptr_ptr;
+      reloc[2]->address     = fixp->fx_frag->fr_address + fixp->fx_where;
+
+      reloc[3] = NULL;
+      break;
+
     default:
       reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
       reloc[1] = NULL;



More information about the Binutils mailing list