aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2004-05-28 21:33:35 +0000
committerDJ Delorie <dj@redhat.com>2004-05-28 21:33:35 +0000
commitdd90f1b254783b1095d8522c96e66f8f92ed7763 (patch)
treeb784b874e4968d8c0b304bdb7e5677c07f04bf98
parent53cb0362bf2181b1fe1611954529c3bb0649d0af (diff)
downloadbinutils-dd90f1b254783b1095d8522c96e66f8f92ed7763.zip
binutils-dd90f1b254783b1095d8522c96e66f8f92ed7763.tar.gz
binutils-dd90f1b254783b1095d8522c96e66f8f92ed7763.tar.bz2
* elf-m10300.c (mn10300_elf_relax_section): Preserve reloc addend
for linking, but otherwise adjust reloc for merged sections.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf-m10300.c19
2 files changed, 21 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0178acd..52c3584 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-28 DJ Delorie <dj@redhat.com>
+
+ * elf-m10300.c (mn10300_elf_relax_section): Preserve reloc addend
+ for linking, but otherwise adjust reloc for merged sections.
+
2004-05-28 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_relax_section): Properly call
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 4a92a1a..d61df46 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -2462,6 +2462,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
asection *sym_sec = NULL;
const char *sym_name;
char *new_name;
+ bfd_vma saved_addend;
/* A local symbol. */
isym = isymbuf + ELF32_R_SYM (irel->r_info);
@@ -2474,13 +2475,25 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
else
sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
- symval = (isym->st_value
- + sym_sec->output_section->vma
- + sym_sec->output_offset);
sym_name = bfd_elf_string_from_elf_section (abfd,
symtab_hdr->sh_link,
isym->st_name);
+ if ((sym_sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (isym->st_info) == STT_SECTION
+ && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
+ {
+ saved_addend = irel->r_addend;
+ symval = _bfd_elf_rela_local_sym (abfd, isym, &sym_sec, irel);
+ symval += irel->r_addend;
+ irel->r_addend = saved_addend;
+ }
+ else
+ {
+ symval = (isym->st_value
+ + sym_sec->output_section->vma
+ + sym_sec->output_offset);
+ }
/* Tack on an ID so we can uniquely identify this
local symbol in the global hash table. */
new_name = bfd_malloc ((bfd_size_type) strlen (sym_name) + 10);