diff options
author | Nick Clifton <nickc@redhat.com> | 2015-05-08 17:28:26 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-05-08 17:28:26 +0100 |
commit | ae8714c2712ef9a179cfa9158a289bd400c0ad97 (patch) | |
tree | 1b2ce963d4100fc1c99a6267f458e3ab16a09c40 /gas/config | |
parent | dd9f02a0ca7a9873717933345e393edb3d5da6bc (diff) | |
download | gdb-ae8714c2712ef9a179cfa9158a289bd400c0ad97.zip gdb-ae8714c2712ef9a179cfa9158a289bd400c0ad97.tar.gz gdb-ae8714c2712ef9a179cfa9158a289bd400c0ad97.tar.bz2 |
Change ARM symbol name verification code so that it only triggers when the form "name = val" is used.
PR gas/18347
* config/tc-arm.h (TC_EQUAL_IN_INSN): Define.
* config/tc-arm.c (arm_tc_equal_in_insn): New function. Move
the symbol name checking code to here from...
(md_undefined_symbo): ... here.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-arm.c | 65 | ||||
-rw-r--r-- | gas/config/tc-arm.h | 3 |
2 files changed, 34 insertions, 34 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 2f6fea6..683774f 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -21625,29 +21625,9 @@ md_pcrel_from_section (fixS * fixP, segT seg) static bfd_boolean flag_warn_syms = TRUE; -/* Under ELF we need to default _GLOBAL_OFFSET_TABLE. - Otherwise we have no need to default values of symbols. */ - -symbolS * -md_undefined_symbol (char * name ATTRIBUTE_UNUSED) +bfd_boolean +arm_tc_equal_in_insn (int c ATTRIBUTE_UNUSED, char * name) { -#ifdef OBJ_ELF - if (name[0] == '_' && name[1] == 'G' - && streq (name, GLOBAL_OFFSET_TABLE_NAME)) - { - if (!GOT_symbol) - { - if (symbol_find (name)) - as_bad (_("GOT already in the symbol table")); - - GOT_symbol = symbol_new (name, undefined_section, - (valueT) 0, & zero_address_frag); - } - - return GOT_symbol; - } -#endif - /* PR 18347 - Warn if the user attempts to create a symbol with the same name as an ARM instruction. Whilst strictly speaking it is allowed, it does mean that the resulting code might be very confusing to the reader. @@ -21662,17 +21642,8 @@ md_undefined_symbol (char * name ATTRIBUTE_UNUSED) Note - ARM instructions are case-insensitive but the strings in the hash table are all stored in lower case, so we must first ensure that name is - lower case too. - - Some names are problematical. Several gas tests for example use: - - b: - - as a label, but of course this matches the branch instruction. For now - we punt and only check names longer than 1. - - FIXME: Should this be made into generic code for all targets ? */ - if (flag_warn_syms && arm_ops_hsh && strlen (name) > 1) + lower case too. */ + if (flag_warn_syms && arm_ops_hsh) { char * nbuf = strdup (name); char * p; @@ -21688,12 +21659,38 @@ md_undefined_symbol (char * name ATTRIBUTE_UNUSED) /* Only warn about the symbol once. To keep the code simple we let hash_insert do the lookup for us. */ if (hash_insert (already_warned, name, NULL) == NULL) - as_warn (_("[-mwarn-syms]: Symbol '%s' matches an ARM instruction - is this intentional ?"), name); + as_warn (_("[-mwarn-syms]: Assignment makes a symbol match an ARM instruction: %s"), name); } else free (nbuf); } + return FALSE; +} + +/* Under ELF we need to default _GLOBAL_OFFSET_TABLE. + Otherwise we have no need to default values of symbols. */ + +symbolS * +md_undefined_symbol (char * name ATTRIBUTE_UNUSED) +{ +#ifdef OBJ_ELF + if (name[0] == '_' && name[1] == 'G' + && streq (name, GLOBAL_OFFSET_TABLE_NAME)) + { + if (!GOT_symbol) + { + if (symbol_find (name)) + as_bad (_("GOT already in the symbol table")); + + GOT_symbol = symbol_new (name, undefined_section, + (valueT) 0, & zero_address_frag); + } + + return GOT_symbol; + } +#endif + return NULL; } diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h index 2216267..22e9027 100644 --- a/gas/config/tc-arm.h +++ b/gas/config/tc-arm.h @@ -389,3 +389,6 @@ extern char arm_comment_chars[]; #define tc_line_separator_chars arm_line_separator_chars extern char arm_line_separator_chars[]; + +#define TC_EQUAL_IN_INSN(c, s) arm_tc_equal_in_insn ((c), (s)) +extern bfd_boolean arm_tc_equal_in_insn (int, char *); |