GAS: Replace macro LITERAL_PREFIXDOLLAR_HEX with a runtime value.
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 21 May 2019 08:11:40 +0000 (10:11 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 21 May 2019 08:29:15 +0000 (10:29 +0200)
In an upcoming commit, I need to be able to set the prefix used
to introduce hexadecimal literal constants using a command line
flag.   This is not currently possible, because the switch which
determines this (LITERAL_PREFIXDOLLAR_HEX) is a macro set at
build time.

This change substitutes it for a variable to be set at start up.

gas/ChangeLog:
    * expr.c (literal_prefix_dollar_hex): New variable.
    (operand)[case '$']: Use the new variable instead of the old macro.
    Also, move this instance of "case '$'" next to the other one, and
    enable it only in the complementary proprocessor case.
    * expr.h (literal_prefix_dollar_hex): Declare it.
    * config/tc-epiphany.c (md_begin): Assign literal_prefix_dollar_hex.
    * config/tc-ip2k.c:      ditto
    * config/tc-mt.c:        ditto
    * config/tc-epiphany.h (LITERAL_PREFIXDOLLAR_HEX): Remove macro definition.
    * config/tc-ip2k.h:      ditto
    * config/tc-mt.h:        ditto

gas/ChangeLog
gas/config/tc-epiphany.c
gas/config/tc-epiphany.h
gas/config/tc-ip2k.c
gas/config/tc-ip2k.h
gas/config/tc-mt.c
gas/config/tc-mt.h
gas/expr.c
gas/expr.h

index 2230f44e550da3a9cf5d850f4eca02cc95e49c98..fbfa00b2db27f0da3a3f189758dc2527660c6326 100644 (file)
@@ -1,3 +1,17 @@
+2019-05-21  John Darrington <john@darrington.wattle.id.au>
+
+       * expr.c (literal_prefix_dollar_hex): New variable.
+       (operand)[case '$']: Use the new variable instead of the old macro.
+       Also, move this instance of "case '$'" next to the other one, and
+       enable it only in the complementary proprocessor case.
+       * expr.h (literal_prefix_dollar_hex): Declare it.
+       * config/tc-epiphany.c (md_begin): Assign literal_prefix_dollar_hex.
+       * config/tc-ip2k.c:      ditto
+       * config/tc-mt.c:        ditto
+       * config/tc-epiphany.h (LITERAL_PREFIXDOLLAR_HEX): Remove macro definition.
+       * config/tc-ip2k.h:      ditto
+       * config/tc-mt.h:        ditto
+
 2019-05-20  Faraz Shahbazker  <fshahbazker@wavecomp.com>
 
        PR 14798
index ca24520ffefc76f6e425e25c9bd8e014ab2cb30f..3117918668fb043abcd48d76fca636aa2b567117 100644 (file)
@@ -145,6 +145,8 @@ md_begin (void)
 
   /* Set the machine type.  */
   bfd_default_set_arch_mach (stdoutput, bfd_arch_epiphany, bfd_mach_epiphany32);
+
+  literal_prefix_dollar_hex = TRUE;
 }
 
 valueT
index ace8f3667b68dd249d8068bb392e1ec5dd258d64..695b970ca2efafffb77ef82c08f75b45e8b017ed 100644 (file)
@@ -37,7 +37,6 @@
 /* We don't need to handle .word strangely.  */
 #define WORKING_DOT_WORD
 
-#define LITERAL_PREFIXDOLLAR_HEX
 #define LITERAL_PREFIXPERCENT_BIN
 #define DOUBLESLASH_LINE_COMMENTS
 
index ab00b05235557a8c84afc4d5a130bd9040e0f41e..0fcc0003d1915fc6a9caa015764aad74063062cc 100644 (file)
@@ -160,6 +160,8 @@ md_begin (void)
 
   /* Set the machine type.  */
   bfd_default_set_arch_mach (stdoutput, bfd_arch_ip2k, ip2k_mach);
+
+  literal_prefix_dollar_hex = TRUE;
 }
 
 
index 0b38c9dcf2003e2f28a285bcd3f9d7261ece6e3e..ae9510d9e1099b1b527982fe7ca8b548ccedde9b 100644 (file)
@@ -38,7 +38,6 @@
 /* We don't need to handle .word strangely.  */
 #define WORKING_DOT_WORD
 
-#define LITERAL_PREFIXDOLLAR_HEX
 #define LITERAL_PREFIXPERCENT_BIN
 #define DOUBLESLASH_LINE_COMMENTS
 
index b93a53eb4bc2f11d420f088be3ce5c2ce8590f3c..bd518547e31ed681d3646aa96ea81ccab596daa2 100644 (file)
@@ -178,6 +178,8 @@ md_begin (void)
 
   /* Set the machine type.  */
   bfd_default_set_arch_mach (stdoutput, bfd_arch_mt, mt_mach);
+
+  literal_prefix_dollar_hex = TRUE;
 }
 
 void
index 111dadd1c65526659dc1bcf6f215cc5eb8cf5208..8a96d2c84f2b3490a3d29dcc866305652756f911 100644 (file)
@@ -41,7 +41,6 @@
 /* All mt instructions are multiples of 32 bits.  */
 #define DWARF2_LINE_MIN_INSN_LENGTH 4
 
-#define LITERAL_PREFIXDOLLAR_HEX
 #define LITERAL_PREFIXPERCENT_BIN
 
 #define md_apply_fix mt_apply_fix
index 3efde88cc0a2c1034022f14454c3fb36c147432c..16c89343a71b23ad3befd1d9ccb5c74765b286b7 100644 (file)
@@ -35,6 +35,8 @@
 #define CHAR_BIT 8
 #endif
 
+bfd_boolean literal_prefix_dollar_hex = FALSE;
+
 static void floating_constant (expressionS * expressionP);
 static valueT generic_bignum_to_int32 (void);
 #ifdef BFD64
@@ -778,15 +780,6 @@ operand (expressionS *expressionP, enum expr_mode mode)
                        expressionP);
       break;
 
-#ifdef LITERAL_PREFIXDOLLAR_HEX
-    case '$':
-      /* $L is the start of a local label, not a hex constant.  */
-      if (* input_line_pointer == 'L')
-      goto isname;
-      integer_constant (16, expressionP);
-      break;
-#endif
-
 #ifdef LITERAL_PREFIXPERCENT_BIN
     case '%':
       integer_constant (2, expressionP);
@@ -1114,7 +1107,21 @@ operand (expressionS *expressionP, enum expr_mode mode)
       }
       break;
 
-#if defined (DOLLAR_DOT) || defined (TC_M68K)
+#if !defined (DOLLAR_DOT) && !defined (TC_M68K)
+    case '$':
+      if (literal_prefix_dollar_hex)
+       {
+         /* $L is the start of a local label, not a hex constant.  */
+         if (* input_line_pointer == 'L')
+               goto isname;
+         integer_constant (16, expressionP);
+       }
+      else
+       {
+         goto isname;
+       }
+      break;
+#else
     case '$':
       /* '$' is the program counter when in MRI mode, or when
         DOLLAR_DOT is defined.  */
index a6cb5cf364d3e2622ca9846e903a8a01080fd4de..c7d0681dbc61b5c69993314febf4251ea5d8a5de 100644 (file)
@@ -187,3 +187,5 @@ extern symbolS *expr_build_uconstant (offsetT);
 extern symbolS *expr_build_dot (void);
 
 int resolve_expression (expressionS *);
+
+extern bfd_boolean literal_prefix_dollar_hex;
This page took 0.043972 seconds and 4 git commands to generate.