aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-12-07 11:12:18 +0000
committerJakub Jelinek <jakub@redhat.com>2001-12-07 11:12:18 +0000
commitc629eae01a0ff6a72882b1a7aad636d38c98bc50 (patch)
treea7f9d57932310321ab7f062176188ba66a8aafd8 /bfd/elf.c
parentedb6ede1be2be050cffe40a93cbee55b93e5840c (diff)
downloadgdb-c629eae01a0ff6a72882b1a7aad636d38c98bc50.zip
gdb-c629eae01a0ff6a72882b1a7aad636d38c98bc50.tar.gz
gdb-c629eae01a0ff6a72882b1a7aad636d38c98bc50.tar.bz2
* elf.c (_bfd_elf_rela_local_sym): Only call
_bfd_merged_section_offset if merge_info is non-NULL. (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New. * elf-bfd.h (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New prototypes. * elf32-arm.h (elf32_arm_final_link_relocate): Use _bfd_elf_section_offset. (elf32_arm_relocate_section): Use _bfd_elf_rel_local_sym. * elf32-i386.c (elf_i386_relocate_section): Use _bfd_elf_section_offset and _bfd_elf_rel_local_sym. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Use _bfd_elf_section_offset. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_create_dynamic_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 81923d1..9c4c087 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6393,7 +6393,8 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel)
+ sec->output_offset
+ sym->st_value);
if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && elf_section_data (sec)->merge_info)
{
asection *msec;
@@ -6408,3 +6409,37 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel)
}
return relocation;
}
+
+bfd_vma
+_bfd_elf_rel_local_sym (abfd, sym, psec, addend)
+ bfd *abfd;
+ Elf_Internal_Sym *sym;
+ asection **psec;
+ bfd_vma addend;
+{
+ asection *sec = *psec;
+
+ if (elf_section_data (sec)->merge_info == NULL)
+ return sym->st_value + addend;
+
+ return _bfd_merged_section_offset (abfd, psec,
+ elf_section_data (sec)->merge_info,
+ sym->st_value + addend, (bfd_vma) 0);
+}
+
+bfd_vma
+_bfd_elf_section_offset (abfd, info, sec, offset)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ bfd_vma offset;
+{
+ struct bfd_elf_section_data *sec_data;
+
+ sec_data = elf_section_data (sec);
+ if (sec_data->stab_info != NULL)
+ return _bfd_stab_section_offset
+ (abfd, &elf_hash_table (info)->stab_info,
+ sec, &sec_data->stab_info, offset);
+ return offset;
+}