aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-08-18 09:47:59 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-08-18 09:50:08 -0700
commitcae1fbbb7e3d770702a0d7a5027b46835e6adc13 (patch)
tree892f4044f4c7e0e5bcd830f51fa7b0728e63050f /bfd/elflink.c
parent2b4bf6afd4506165007c0e76bc7c4381031cfaf6 (diff)
downloadgdb-cae1fbbb7e3d770702a0d7a5027b46835e6adc13.zip
gdb-cae1fbbb7e3d770702a0d7a5027b46835e6adc13.tar.gz
gdb-cae1fbbb7e3d770702a0d7a5027b46835e6adc13.tar.bz2
Return reloc_class_ifunc for reloc against IFUNC
elf_XXX_reloc_type_class should return reloc_class_ifunc for relocation against STT_GNU_IFUNC symbol. bfd/ PR ld/18841 * elf-bfd.h (elf_link_hash_table): Add dynsym. * elf32-i386.c (elf_i386_reloc_type_class): Return reloc_class_ifunc for relocation against STT_GNU_IFUNC symbol. * elf64-x86-64.c (elf_x86_64_reloc_type_class): Likewise. * elflink.c (_bfd_elf_link_create_dynamic_sections): Set dynsym. (bfd_elf_size_dynsym_hash_dynstr): Use dynsym. (elf_final_link_info): Remove dynsym_sec. (elf_link_output_extsym): Replace dynsym_sec with dynsym. (bfd_elf_final_link): Remove reference to dynsym_sec. Replace dynsym_sec with dynsym. ld/testsuite/ PR ld/18841 * ld-ifunc/ifunc.exp: Add a test for PR ld/18841. * ld-ifunc/pr18841.out: New file. * ld-ifunc/pr18841a.c: Likewise. * ld-ifunc/pr18841b.c: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index e4a9ced..7f04271 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -279,6 +279,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
+ elf_hash_table (info)->dynsym = s;
s = bfd_make_section_anyway_with_flags (abfd, ".dynstr",
flags | SEC_READONLY);
@@ -6545,7 +6546,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
the final symbol table, because until then we do not know the
correct value to give the symbols. We built the .dynstr
section as we went along in elf_link_add_object_symbols. */
- s = bfd_get_linker_section (dynobj, ".dynsym");
+ s = elf_hash_table (info)->dynsym;
BFD_ASSERT (s != NULL);
s->size = dynsymcount * bed->s->sizeof_sym;
@@ -7541,8 +7542,6 @@ struct elf_final_link_info
bfd *output_bfd;
/* Symbol string table. */
struct elf_strtab_hash *symstrtab;
- /* .dynsym section. */
- asection *dynsym_sec;
/* .hash section. */
asection *hash_sec;
/* symbol version section (.gnu.version). */
@@ -9314,7 +9313,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
/* If this symbol should be put in the .dynsym section, then put it
there now. We already know the symbol index. We also fill in
the entry in the .hash section. */
- if (flinfo->dynsym_sec != NULL
+ if (elf_hash_table (flinfo->info)->dynsym != NULL
&& h->dynindx != -1
&& elf_hash_table (flinfo->info)->dynamic_sections_created)
{
@@ -9344,7 +9343,8 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
}
sym.st_name = h->dynstr_index;
- esym = flinfo->dynsym_sec->contents + h->dynindx * bed->s->sizeof_sym;
+ esym = (elf_hash_table (flinfo->info)->dynsym->contents
+ + h->dynindx * bed->s->sizeof_sym);
if (!check_dynsym (flinfo->output_bfd, &sym))
{
eoinfo->failed = TRUE;
@@ -10868,13 +10868,11 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (! dynamic)
{
- flinfo.dynsym_sec = NULL;
flinfo.hash_sec = NULL;
flinfo.symver_sec = NULL;
}
else
{
- flinfo.dynsym_sec = bfd_get_linker_section (dynobj, ".dynsym");
flinfo.hash_sec = bfd_get_linker_section (dynobj, ".hash");
/* Note that dynsym_sec can be NULL (on VMS). */
flinfo.symver_sec = bfd_get_linker_section (dynobj, ".gnu.version");
@@ -11407,11 +11405,12 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
symtab_hdr->sh_info = bfd_get_symcount (abfd);
if (dynamic
- && flinfo.dynsym_sec != NULL
- && flinfo.dynsym_sec->output_section != bfd_abs_section_ptr)
+ && elf_hash_table (info)->dynsym != NULL
+ && (elf_hash_table (info)->dynsym->output_section
+ != bfd_abs_section_ptr))
{
Elf_Internal_Sym sym;
- bfd_byte *dynsym = flinfo.dynsym_sec->contents;
+ bfd_byte *dynsym = elf_hash_table (info)->dynsym->contents;
long last_local = 0;
/* Write out the section symbols for the output sections. */
@@ -11484,7 +11483,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
}
- elf_section_data (flinfo.dynsym_sec->output_section)->this_hdr.sh_info =
+ elf_section_data (elf_hash_table (info)->dynsym->output_section)->this_hdr.sh_info =
last_local + 1;
}