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

[PATCH] MIPS/GAS: Pass MIPS16 macro variadic arguments by reference


Hi,

 Following earlier discussion I have updated the call to 
mips16_macro_build() to pass variadic arguments by reference rather than 
value.  The latter is a grey area of the C standard and is not supported 
by GCC in a way portable across all the supported architectures.  This 
change makes the call consistent with the upcoming microMIPS change.

 Regression-tested succesfully on mips-sde-elf and mips-linux-gnu targets.

2010-07-26  Maciej W. Rozycki  <macro@codesourcery.com>

	gas/
	* config/tc-mips.c (mips16_macro_build): Pass "args" by
	reference rather than value. 
	(macro_build): Update accordingly.

 OK to apply?

  Maciej

binutils-mips16-macro.diff
Index: binutils-fsf-trunk-quilt/gas/config/tc-mips.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/config/tc-mips.c	2010-07-25 23:54:06.000000000 +0100
+++ binutils-fsf-trunk-quilt/gas/config/tc-mips.c	2010-07-25 23:54:11.000000000 +0100
@@ -1064,7 +1064,7 @@ static void append_insn
 static void mips_no_prev_insn (void);
 static void macro_build (expressionS *, const char *, const char *, ...);
 static void mips16_macro_build
-  (expressionS *, const char *, const char *, va_list);
+  (expressionS *, const char *, const char *, va_list *);
 static void load_register (int, expressionS *, int);
 static void macro_start (void);
 static void macro_end (void);
@@ -3623,7 +3623,7 @@ macro_build (expressionS *ep, const char
 
   if (mips_opts.mips16)
     {
-      mips16_macro_build (ep, name, fmt, args);
+      mips16_macro_build (ep, name, fmt, &args);
       va_end (args);
       return;
     }
@@ -3849,7 +3849,7 @@ macro_build (expressionS *ep, const char
 
 static void
 mips16_macro_build (expressionS *ep, const char *name, const char *fmt,
-		    va_list args)
+		    va_list *args)
 {
   struct mips_opcode *mo;
   struct mips_cl_insn insn;
@@ -3885,20 +3885,20 @@ mips16_macro_build (expressionS *ep, con
 
 	case 'y':
 	case 'w':
-	  MIPS16_INSERT_OPERAND (RY, insn, va_arg (args, int));
+	  MIPS16_INSERT_OPERAND (RY, insn, va_arg (*args, int));
 	  continue;
 
 	case 'x':
 	case 'v':
-	  MIPS16_INSERT_OPERAND (RX, insn, va_arg (args, int));
+	  MIPS16_INSERT_OPERAND (RX, insn, va_arg (*args, int));
 	  continue;
 
 	case 'z':
-	  MIPS16_INSERT_OPERAND (RZ, insn, va_arg (args, int));
+	  MIPS16_INSERT_OPERAND (RZ, insn, va_arg (*args, int));
 	  continue;
 
 	case 'Z':
-	  MIPS16_INSERT_OPERAND (MOVE32Z, insn, va_arg (args, int));
+	  MIPS16_INSERT_OPERAND (MOVE32Z, insn, va_arg (*args, int));
 	  continue;
 
 	case '0':
@@ -3908,14 +3908,14 @@ mips16_macro_build (expressionS *ep, con
 	  continue;
 
 	case 'X':
-	  MIPS16_INSERT_OPERAND (REGR32, insn, va_arg (args, int));
+	  MIPS16_INSERT_OPERAND (REGR32, insn, va_arg (*args, int));
 	  continue;
 
 	case 'Y':
 	  {
 	    int regno;
 
-	    regno = va_arg (args, int);
+	    regno = va_arg (*args, int);
 	    regno = ((regno & 7) << 2) | ((regno & 0x18) >> 3);
 	    MIPS16_INSERT_OPERAND (REG32R, insn, regno);
 	  }
@@ -3954,7 +3954,7 @@ mips16_macro_build (expressionS *ep, con
 	  continue;
 
 	case '6':
-	  MIPS16_INSERT_OPERAND (IMM6, insn, va_arg (args, int));
+	  MIPS16_INSERT_OPERAND (IMM6, insn, va_arg (*args, int));
 	  continue;
 	}
 


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