gas TC_PARSE_CONS_EXPRESSION communication with TC_CONS_FIX_NEW

Nicholas Clifton nickc@redhat.com
Wed Apr 9 13:11:00 GMT 2014


Hi Alan,

> A number of targets pass extra information from TC_PARSE_CONS_EXPRESSION
> to TC_CONS_FIX_NEW via static variables.  That's OK, but not best
> practice.  tc-ppc.c is worse, implementing its own replacement for
> cons() because the generic one doesn't allow relocation modifiers
> on constants.  This patch fixes both of these warts.

You missed a couple of targets. :-)

Fixed with this patch.

Cheers
   Nick

gas/ChangeLog
2014-04-09  Nick Clifton  <nickc@redhat.com>

	* config/tc-rl78.h (TC_CONS_FIX_NEW): Add RELOC parameter.
	* config/tc-z80.h (TC_CONS_FIX_NEW): Discard RELOC parameter.
	* config/tc-aarch64.h (TC_CONS_FIX_NEW): Discard RELOC parameter.
	* read.c (emit_expr_fix): Mark the r parameter as potentially
	unused.

diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h
index e8e26da..94a3dc9 100644
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -114,7 +114,7 @@ void aarch64_copy_symbol_attributes (symbolS *, 
symbolS *);
     || (FIX)->fx_r_type == BFD_RELOC_32			\
     || TC_FORCE_RELOCATION (FIX))

-#define TC_CONS_FIX_NEW cons_fix_new_aarch64
+#define TC_CONS_FIX_NEW(f,w,s,e,r) cons_fix_new_aarch64 ((f), (w), (s), 
(e))

  /* Max code alignment is 32 bytes */
  #define MAX_MEM_FOR_RS_ALIGN_CODE 31
diff --git a/gas/config/tc-rl78.h b/gas/config/tc-rl78.h
index 2621ab64..5b6a312 100644
--- a/gas/config/tc-rl78.h
+++ b/gas/config/tc-rl78.h
@@ -67,7 +67,7 @@ extern long md_pcrel_from_section (struct fix *, segT);
    rl78_validate_fix_sub (FIX)
  extern int rl78_validate_fix_sub (struct fix *);

-#define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP) \
+#define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP, RET)	\
    rl78_cons_fix_new (FRAG, WHERE, NBYTES, EXP)
  extern void rl78_cons_fix_new (fragS *, int, int, expressionS *);

diff --git a/gas/config/tc-z80.h b/gas/config/tc-z80.h
index 72e868f..7409871 100644
--- a/gas/config/tc-z80.h
+++ b/gas/config/tc-z80.h
@@ -55,7 +55,7 @@
  /* Define some functions to be called by generic code.  */
  #define md_end               z80_md_end
  #define md_start_line_hook() { if (z80_start_line_hook ()) continue; }
-#define TC_CONS_FIX_NEW z80_cons_fix_new
+#define TC_CONS_FIX_NEW(f,w,s,e,r)  z80_cons_fix_new ((f), (w), (s), (e))

  extern void z80_md_end (void);
  extern int z80_start_line_hook (void);
diff --git a/gas/read.c b/gas/read.c
index 066783c..8e1b06e 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -4412,7 +4412,7 @@ emit_expr_with_reloc (expressionS *exp,

  void
  emit_expr_fix (expressionS *exp, unsigned int nbytes, fragS *frag, 
char *p,
-	       TC_PARSE_CONS_RETURN_TYPE r)
+	       TC_PARSE_CONS_RETURN_TYPE r ATTRIBUTE_UNUSED)
  {
    int offset = 0;
    unsigned int size = nbytes;



More information about the Binutils mailing list