diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2005-04-26 17:15:22 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2005-04-26 17:15:22 +0000 |
commit | 60938e80e69ba5182cdd924b757d783c43637104 (patch) | |
tree | ba3f7708e0e6f956a044780c6c155cc959bf945d /gas/write.c | |
parent | 6156ef10ad0d05611bb9f6d05d79ab0e02ddc8ad (diff) | |
download | gdb-60938e80e69ba5182cdd924b757d783c43637104.zip gdb-60938e80e69ba5182cdd924b757d783c43637104.tar.gz gdb-60938e80e69ba5182cdd924b757d783c43637104.tar.bz2 |
gas/
2005-04-26 H.J. Lu <hongjiu.lu@intel.com>
* config/obj-multi.h (FAKE_LABEL_NAME): Defined.
* read.c (pseudo_set): Disallow symbol set to common symbol.
PR 857
* write.c (write_object_file): Report common symbol name when
disallowing local symbol set to common symbol.
(adjust_reloc_syms): Disallow local symbol set to undefined
symbol.
gas/testsuite/
2005-04-26 H.J. Lu <hongjiu.lu@intel.com>
* gas/all/assign.s: Make `x' and `y' global.
Diffstat (limited to 'gas/write.c')
-rw-r--r-- | gas/write.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gas/write.c b/gas/write.c index e154cda..417e0e9 100644 --- a/gas/write.c +++ b/gas/write.c @@ -787,12 +787,20 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED, if (fixp->fx_subsy != NULL) resolve_symbol_value (fixp->fx_subsy); - /* If this symbol is equated to an undefined symbol, convert - the fixup to being against that symbol. */ + /* If this symbol is equated to an undefined or common symbol, + convert the fixup to being against that symbol. */ if (symbol_equated_reloc_p (sym)) { + symbolS *new_sym + = symbol_get_value_expression (sym)->X_add_symbol; + const char *name = S_GET_NAME (sym); + if (!S_IS_COMMON (new_sym) + && strcmp (name, FAKE_LABEL_NAME) + && (!S_IS_EXTERNAL (sym) || S_IS_LOCAL (sym))) + as_bad (_("Local symbol `%s' can't be equated to undefined symbol `%s'"), + name, S_GET_NAME (new_sym)); fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number; - sym = symbol_get_value_expression (sym)->X_add_symbol; + sym = new_sym; fixp->fx_addsy = sym; } @@ -1927,9 +1935,15 @@ write_object_file (void) symbols. */ if (symbol_equated_reloc_p (symp)) { - if (S_IS_COMMON (symp)) - as_bad (_("`%s' can't be equated to common symbol"), - S_GET_NAME (symp)); + const char *name = S_GET_NAME (symp); + if (S_IS_COMMON (symp) + && strcmp (name, FAKE_LABEL_NAME) + && (!S_IS_EXTERNAL (symp) || S_IS_LOCAL (symp))) + { + expressionS *e = symbol_get_value_expression (symp); + as_bad (_("Local symbol `%s' can't be equated to common symbol `%s'"), + name, S_GET_NAME (e->X_add_symbol)); + } symbol_remove (symp, &symbol_rootP, &symbol_lastP); continue; } |