This is the mail archive of the binutils-cvs@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]

[binutils-gdb] Fix RX GAS handling of integer bignums.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f0e8c65e02e84ceb85b569508aa4f54ecb0a8abe

commit f0e8c65e02e84ceb85b569508aa4f54ecb0a8abe
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jun 8 11:32:38 2015 +0100

    Fix RX GAS handling of integer bignums.
    
    	* config/tc-rx.c (rx_op): Correct handling of integer bignums.

Diff:
---
 gas/ChangeLog      |  4 ++++
 gas/config/tc-rx.c | 51 +++++++++++++++++++++++++++++----------------------
 2 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 2893726..4b78a51 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-08  Nick Clifton  <nickc@redhat.com>
+
+	* config/tc-rx.c (rx_op): Correct handling of integer bignums.
+
 2015-06-04  Matthew Wahab  <matthew.wahab@arm.com>
 
 	* NEWS: Mention ARMv8.1 support in the Aarch64 port.
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index 4e58f88..ec54b32 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -942,43 +942,50 @@ rx_field5s2 (expressionS exp)
 void
 rx_op (expressionS exp, int nbytes, int type)
 {
-  int v = 0;
+  offsetT v = 0;
 
   if ((exp.X_op == O_constant || exp.X_op == O_big)
       && type != RXREL_PCREL)
     {
-      if (exp.X_op == O_big && exp.X_add_number <= 0)
+      if (exp.X_op == O_big)
 	{
-	  LITTLENUM_TYPE w[2];
-	  char * ip = rx_bytes.ops + rx_bytes.n_ops;
+	  if (exp.X_add_number == -1)
+	    {
+	      LITTLENUM_TYPE w[2];
+	      char * ip = rx_bytes.ops + rx_bytes.n_ops;
 
-	  gen_to_words (w, F_PRECISION, 8);
+	      gen_to_words (w, F_PRECISION, 8);
 #if RX_OPCODE_BIG_ENDIAN
-	  ip[0] = w[0] >> 8;
-	  ip[1] = w[0];
-	  ip[2] = w[1] >> 8;
-	  ip[3] = w[1];
+	      ip[0] = w[0] >> 8;
+	      ip[1] = w[0];
+	      ip[2] = w[1] >> 8;
+	      ip[3] = w[1];
 #else
-	  ip[3] = w[0] >> 8;
-	  ip[2] = w[0];
-	  ip[1] = w[1] >> 8;
-	  ip[0] = w[1];
+	      ip[3] = w[0] >> 8;
+	      ip[2] = w[0];
+	      ip[1] = w[1] >> 8;
+	      ip[0] = w[1];
 #endif
-	  rx_bytes.n_ops += 4;
+	      rx_bytes.n_ops += 4;
+	      return;
+	    }
+
+	  v = ((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS)
+	    |  (generic_bignum[0] & LITTLENUM_MASK);
+
 	}
       else
+	v = exp.X_add_number;
+
+      while (nbytes)
 	{
-	  v = exp.X_add_number;
-	  while (nbytes)
-	    {
 #if RX_OPCODE_BIG_ENDIAN
-	      OP ((v >> (8 * (nbytes - 1))) & 0xff);
+	  OP ((v >> (8 * (nbytes - 1))) & 0xff);
 #else
-	      OP (v & 0xff);
-	      v >>= 8;
+	  OP (v & 0xff);
+	  v >>= 8;
 #endif
-	      nbytes --;
-	    }
+	  nbytes --;
 	}
     }
   else


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