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.
* 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
This commit is contained in:
John Darrington
2019-05-20 19:53:30 +02:00
parent efa9760914
commit cffc205c9e
8 changed files with 21 additions and 9 deletions

View 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,14 +780,19 @@ 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);
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;
#endif
#ifdef LITERAL_PREFIXPERCENT_BIN
case '%':