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]

PATCH:


In a 32-bit->64-bit cross compilation environment, GCC may emit 8-byte
integer literals as signed values.  However, GAS does not handle "-"
applied to a bignum, so the assembler will fail to assemble such
files.  This patch adds support for applying "~", "-", and "!" to
bignums in GAS.

OK to apply?

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-08-10  Mark Mitchell  <mark@codesourcery.com>

	* expr.c (operand): Handle the "~", "-", and "!" operators applied
	to bignums.

Index: gas/expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.51
diff -c -5 -p -r1.51 expr.c
*** gas/expr.c	23 May 2004 04:35:11 -0000	1.51
--- gas/expr.c	10 Aug 2004 23:39:39 -0000
*************** operand (expressionS *expressionP)
*** 1074,1083 ****
--- 1074,1112 ----
  	    if (generic_floating_point_number.sign == '+')
  	      generic_floating_point_number.sign = '-';
  	    else
  	      generic_floating_point_number.sign = 'N';
  	  }
+ 	else if (expressionP->X_op == O_big
+ 		 && expressionP->X_add_number > 0)
+ 	  {
+ 	    int i;
+ 
+ 	    if (c == '~' || c == '-')
+ 	      {
+ 		for (i = 0; i < expressionP->X_add_number; ++i)
+ 		  generic_bignum[i] = ~generic_bignum[i];
+ 		if (c == '-')
+ 		  for (i = 0; i < expressionP->X_add_number; ++i)
+ 		    {
+ 		      generic_bignum[i] += 1;
+ 		      if (generic_bignum[i])
+ 			break;
+ 		    }
+ 	      }
+ 	    else if (c == '!')
+ 	      {
+ 		int nonzero = 0;
+ 		for (i = 0; i < expressionP->X_add_number; ++i)
+ 		  {
+ 		    if (generic_bignum[i])
+ 		      nonzero = 1;
+ 		    generic_bignum[i] = 0;
+ 		  }
+ 		generic_bignum[0] = nonzero;
+ 	      }
+ 	  }
  	else if (expressionP->X_op != O_illegal
  		 && expressionP->X_op != O_absent)
  	  {
  	    expressionP->X_add_symbol = make_expr_symbol (expressionP);
  	    if (c == '-')


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