summaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2016-12-19 10:37:23 -0800
committerCary Coutant <ccoutant@gmail.com>2016-12-19 10:37:34 -0800
commit89ede9f53b74f84febcd1c2a6db8b03f390b62ec (patch)
tree3306b0e138f370414528b2d9091e99503e4b5e81 /gold/symtab.cc
parent16e69324ec7fbe4ea12f2a0a069ad207ac8e3f97 (diff)
downloadbinutils-gdb-89ede9f53b74f84febcd1c2a6db8b03f390b62ec.tar.gz
Fix forced allocation of common (-d) during -r links.
If the .bss section has other data in it besides common allocations, gold was subtracting the wrong section start address from the symbol value. gold/ PR gold/20976 * symtab.cc (Symbol_table::sized_write_globals): Use address of output section, not input section. * testsuite/Makefile.am (pr20976): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/pr20976.c: New source file.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index c872f47d386..6865190f880 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -3111,7 +3111,11 @@ Symbol_table::sized_write_globals(const Stringpool* sympool,
// In object files symbol values are section
// relative.
if (parameters->options().relocatable())
- sym_value -= od->address();
+ {
+ Output_section* os = od->output_section();
+ gold_assert(os != NULL);
+ sym_value -= os->address();
+ }
}
break;