diff options
author | Cary Coutant <ccoutant@google.com> | 2013-04-15 16:34:12 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2013-04-15 16:34:12 +0000 |
commit | 502e8a84302cfcc70166bd60cc6465a3e913cb8c (patch) | |
tree | 0602206c4e18bf6cab9f900cce1ed97f87fd61b9 /gold/symtab.cc | |
parent | 4d40cad2035955599e42cb853b5d331eeefd6622 (diff) | |
download | gdb-502e8a84302cfcc70166bd60cc6465a3e913cb8c.zip gdb-502e8a84302cfcc70166bd60cc6465a3e913cb8c.tar.gz gdb-502e8a84302cfcc70166bd60cc6465a3e913cb8c.tar.bz2 |
gold/
* symtab.cc (Symbol_table::sized_write_globals): Subtract
section starting address for relocatable link.
* testsuite/Makefile.am (script_test_11): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/script_test_11.c: New source file.
* testsuite/script_test_11.t: New linker script.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r-- | gold/symtab.cc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc index 17a0f55..2e17529 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -2940,15 +2940,24 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, break; case Symbol::IN_OUTPUT_DATA: - shndx = sym->output_data()->out_shndx(); - if (shndx >= elfcpp::SHN_LORESERVE) - { - if (sym_index != -1U) - symtab_xindex->add(sym_index, shndx); - if (dynsym_index != -1U) - dynsym_xindex->add(dynsym_index, shndx); - shndx = elfcpp::SHN_XINDEX; - } + { + Output_data* od = sym->output_data(); + + shndx = od->out_shndx(); + if (shndx >= elfcpp::SHN_LORESERVE) + { + if (sym_index != -1U) + symtab_xindex->add(sym_index, shndx); + if (dynsym_index != -1U) + dynsym_xindex->add(dynsym_index, shndx); + shndx = elfcpp::SHN_XINDEX; + } + + // In object files symbol values are section + // relative. + if (parameters->options().relocatable()) + sym_value -= od->address(); + } break; case Symbol::IN_OUTPUT_SEGMENT: |