diff options
author | Nick Clifton <nickc@redhat.com> | 2009-06-29 11:55:13 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-06-29 11:55:13 +0000 |
commit | 2709f5702f7c50b89b3212b2e9ec2d96c1a8f4c2 (patch) | |
tree | f70f28afdd0909695665df2d16d483b41d8a300b /bfd | |
parent | 05413229fd3a49f190fd6e9eeb6498f412dd9074 (diff) | |
download | gdb-2709f5702f7c50b89b3212b2e9ec2d96c1a8f4c2.zip gdb-2709f5702f7c50b89b3212b2e9ec2d96c1a8f4c2.tar.gz gdb-2709f5702f7c50b89b3212b2e9ec2d96c1a8f4c2.tar.bz2 |
* elf-m10300.c (mn10300_elf_relax_section): Allow for the
different uses of the relocations addend when a symbol is in a
merged section.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf-m10300.c | 23 |
2 files changed, 27 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8708dc9..6b00d40 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2009-06-29 Nick Clifton <nickc@redhat.com> + + * elf-m10300.c (mn10300_elf_relax_section): Allow for the + different uses of the relocations addend when a symbol is in a + merged section. + 2009-06-27 H.J. Lu <hongjiu.lu@intel.com> PR ld/10337 diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index a58be7b..354a503 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -2783,11 +2783,30 @@ mn10300_elf_relax_section (bfd *abfd, if ((sym_sec->flags & SEC_MERGE) && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE) { - symval = isym->st_value + irel->r_addend; + symval = isym->st_value; + + /* GAS may reduce relocations against symbols in SEC_MERGE + sections to a relocation against the section symbol when + the original addend was zero. When the reloc is against + a section symbol we should include the addend in the + offset passed to _bfd_merged_section_offset, since the + location of interest is the original symbol. On the + other hand, an access to "sym+addend" where "sym" is not + a section symbol should not include the addend; Such an + access is presumed to be an offset from "sym"; The + location of interest is just "sym". */ + if (ELF_ST_TYPE (isym->st_info) == STT_SECTION) + symval += irel->r_addend; + symval = _bfd_merged_section_offset (abfd, & sym_sec, elf_section_data (sym_sec)->sec_info, symval); - symval += sym_sec->output_section->vma + sym_sec->output_offset - irel->r_addend; + + if (ELF_ST_TYPE (isym->st_info) != STT_SECTION) + symval += irel->r_addend; + + symval += sym_sec->output_section->vma + + sym_sec->output_offset - irel->r_addend; } else symval = (isym->st_value |