aboutsummaryrefslogtreecommitdiff
path: root/gas/write.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-08-11 07:41:51 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-08-11 07:42:02 -0700
commit76db0a2e171d2c6780e0388840e3a10ffe7e9ee2 (patch)
tree189b45638210ddc041cd41d239c317fee36b6e32 /gas/write.c
parentde7985c3cca1358b21b49a9872455e2032f48ee3 (diff)
downloadgdb-76db0a2e171d2c6780e0388840e3a10ffe7e9ee2.zip
gdb-76db0a2e171d2c6780e0388840e3a10ffe7e9ee2.tar.gz
gdb-76db0a2e171d2c6780e0388840e3a10ffe7e9ee2.tar.bz2
Also disallow global alias of common symbol
We can't create alias of common symbol. Local alias of common symbol has been disallowed. But global alias of common symbol is disallowed when the common symbol is seen first and silently dropped otherwise. This patch disallows alias of common symbol in all cases. gas/ PR gas/21667 * read.c (pseudo_set): Update error message for alias of common symbol. * write.c (write_object_file): Disallow both local and global aliases of common symbol. * testsuite/gas/elf/common5a.d: New file. * testsuite/gas/elf/common5a.l: Likewise. * testsuite/gas/elf/common5a.s: Likewise. * testsuite/gas/elf/common5b.d: Likewise. * testsuite/gas/elf/common5b.l: Likewise. * testsuite/gas/elf/common5b.s: Likewise. * testsuite/gas/elf/common5c.d: Likewise. * testsuite/gas/elf/common5c.s: Likewise. * testsuite/gas/elf/common5d.d: Likewise. * testsuite/gas/elf/common5d.s: Likewise. * testsuite/gas/elf/elf.exp: Run common5a, common5b, common5c and common5d.
Diffstat (limited to 'gas/write.c')
-rw-r--r--gas/write.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gas/write.c b/gas/write.c
index 8efdbc5..4f6547d 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -2107,12 +2107,11 @@ write_object_file (void)
if (S_IS_COMMON (symp)
&& !TC_FAKE_LABEL (sname)
- && !S_IS_WEAKREFR (symp)
- && (!S_IS_EXTERNAL (symp) || S_IS_LOCAL (symp)))
+ && !S_IS_WEAKREFR (symp))
{
expressionS *e = symbol_get_value_expression (symp);
- as_bad (_("Local symbol `%s' can't be equated to common symbol `%s'"),
+ as_bad (_("`%s' can't be equated to common symbol `%s'"),
sname, S_GET_NAME (e->X_add_symbol));
}
if (S_GET_SEGMENT (symp) == reg_section)