aboutsummaryrefslogtreecommitdiff
path: root/gas/expr.c
diff options
context:
space:
mode:
authorJohn Darrington <john@darrington.wattle.id.au>2019-05-21 10:11:40 +0200
committerJohn Darrington <john@darrington.wattle.id.au>2019-05-21 10:29:15 +0200
commite2d1595531b62487749e1af680d8f0c48c684feb (patch)
tree1fa82c246269596f8b761e726779c788a9451289 /gas/expr.c
parent7622049e0bef81fab900860400838bc977449892 (diff)
downloadgdb-e2d1595531b62487749e1af680d8f0c48c684feb.zip
gdb-e2d1595531b62487749e1af680d8f0c48c684feb.tar.gz
gdb-e2d1595531b62487749e1af680d8f0c48c684feb.tar.bz2
GAS: Replace macro LITERAL_PREFIXDOLLAR_HEX with a runtime value.
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
Diffstat (limited to 'gas/expr.c')
-rw-r--r--gas/expr.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/gas/expr.c b/gas/expr.c
index 3efde88..16c8934 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -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. */