diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-06-07 08:06:22 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-06-07 08:06:22 -0700 |
commit | 9b8a8575b43157a55a815814e15349ddb0865165 (patch) | |
tree | aa007006d80d982db2a577d5de22acfc617b7a70 /bfd | |
parent | 82836c928ffc6aaa9e594ba69af5f446bdc95bf4 (diff) | |
download | gdb-9b8a8575b43157a55a815814e15349ddb0865165.zip gdb-9b8a8575b43157a55a815814e15349ddb0865165.tar.gz gdb-9b8a8575b43157a55a815814e15349ddb0865165.tar.bz2 |
elf64-hppa: Replace plt_sec/plt_rel_sec with root.splt/root.srelplt
elf64-hppa should use root.splt and root.srelplt instead of plt_sec and
plt_rel_sec so that elflink.c can see splt and srelplt. This fixed:
FAIL: ld-elf/pr19539
* elf64-hppa.c (elf64_hppa_link_hash_table): Remove plt_sec and
plt_rel_sec.
(elf64_hppa_check_relocs): Replace plt_sec/plt_rel_sec with
root.splt/root.srelplt.
(elf64_hppa_create_dynamic_sections): Likewise.
(elf64_hppa_size_dynamic_sections): Likewise.
(elf64_hppa_finish_dynamic_symbol): Likewise.
(elf_hppa_final_link): Likewise.
(elf_hppa_final_link_relocate): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 12 | ||||
-rw-r--r-- | bfd/elf64-hppa.c | 38 |
2 files changed, 30 insertions, 20 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 12123ed..0506a29 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2020-06-07 H.J. Lu <hongjiu.lu@intel.com> + + * elf64-hppa.c (elf64_hppa_link_hash_table): Remove plt_sec and + plt_rel_sec. + (elf64_hppa_check_relocs): Replace plt_sec/plt_rel_sec with + root.splt/root.srelplt. + (elf64_hppa_create_dynamic_sections): Likewise. + (elf64_hppa_size_dynamic_sections): Likewise. + (elf64_hppa_finish_dynamic_symbol): Likewise. + (elf_hppa_final_link): Likewise. + (elf_hppa_final_link_relocate): Likewise. + 2020-06-06 H.J. Lu <hongjiu.lu@intel.com> * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Updated. diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 7fc2dc0..1088bcc 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -117,8 +117,6 @@ struct elf64_hppa_link_hash_table /* Shortcuts to get to the various linker defined sections. */ asection *dlt_sec; asection *dlt_rel_sec; - asection *plt_sec; - asection *plt_rel_sec; asection *opd_sec; asection *opd_rel_sec; asection *other_rel_sec; @@ -802,7 +800,7 @@ elf64_hppa_check_relocs (bfd *abfd, if (need_entry & NEED_PLT) { - if (! hppa_info->plt_sec + if (! hppa_info->root.splt && ! get_plt (abfd, info, hppa_info)) goto err_out; @@ -1181,7 +1179,7 @@ get_plt (bfd *abfd, asection *plt; bfd *dynobj; - plt = hppa_info->plt_sec; + plt = hppa_info->root.splt; if (!plt) { dynobj = hppa_info->root.dynobj; @@ -1201,7 +1199,7 @@ get_plt (bfd *abfd, return FALSE; } - hppa_info->plt_sec = plt; + hppa_info->root.splt = plt; } return TRUE; @@ -1360,7 +1358,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd, if (s == NULL || !bfd_set_section_alignment (s, 3)) return FALSE; - hppa_info->plt_rel_sec = s; + hppa_info->root.srelplt = s; s = bfd_make_section_anyway_with_flags (abfd, ".rela.data", (SEC_ALLOC | SEC_LOAD @@ -1454,7 +1452,7 @@ allocate_dynrel_entries (struct elf_link_hash_entry *eh, void *data) else if (shared) t = 2 * sizeof (Elf64_External_Rela); - hppa_info->plt_rel_sec->size += t; + hppa_info->root.srelplt->size += t; } return TRUE; @@ -1653,8 +1651,8 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) } else { - sec = hppa_info->plt_sec; - srel = hppa_info->plt_rel_sec; + sec = hppa_info->root.splt; + srel = hppa_info->root.srelplt; for (; local_plt < end_local_plt; ++local_plt) { if (*local_plt > 0) @@ -1707,12 +1705,12 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) hppa_info->dlt_sec->size = data.ofs; } - if (hppa_info->plt_sec) + if (hppa_info->root.splt) { - data.ofs = hppa_info->plt_sec->size; + data.ofs = hppa_info->root.splt->size; elf_link_hash_traverse (&hppa_info->root, allocate_global_data_plt, &data); - hppa_info->plt_sec->size = data.ofs; + hppa_info->root.splt->size = data.ofs; } if (hppa_info->stub_sec) @@ -1950,9 +1948,9 @@ elf64_hppa_finish_dynamic_symbol (bfd *output_bfd, return FALSE; stub = hppa_info->stub_sec; - splt = hppa_info->plt_sec; + splt = hppa_info->root.splt; sopd = hppa_info->opd_sec; - spltrel = hppa_info->plt_rel_sec; + spltrel = hppa_info->root.srelplt; /* Incredible. It is actually necessary to NOT use the symbol's real value when building the dynamic symbol table for a shared library. @@ -2532,13 +2530,13 @@ elf64_hppa_finish_dynamic_sections (bfd *output_bfd, break; case DT_JMPREL: - s = hppa_info->plt_rel_sec; + s = hppa_info->root.srelplt; dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: - s = hppa_info->plt_rel_sec; + s = hppa_info->root.srelplt; dyn.d_un.d_val = s->size; bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); break; @@ -2563,7 +2561,7 @@ elf64_hppa_finish_dynamic_sections (bfd *output_bfd, /* There is some question about whether or not the size of the PLT relocs should be included here. HP's tools do it, so we'll emulate them. */ - s = hppa_info->plt_rel_sec; + s = hppa_info->root.srelplt; dyn.d_un.d_val += s->size; bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); break; @@ -2981,7 +2979,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info) that order) and set __gp to the base address of whichever section is found first. */ - sec = hppa_info->plt_sec; + sec = hppa_info->root.splt; if (sec && ! (sec->flags & SEC_EXCLUDE)) gp_val = (sec->output_offset + sec->output_section->vma @@ -3530,8 +3528,8 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel, to the start of the DLT, so we have to compute the absolute address, then subtract out the value of __gp. */ value = (hh->plt_offset - + hppa_info->plt_sec->output_offset - + hppa_info->plt_sec->output_section->vma); + + hppa_info->root.splt->output_offset + + hppa_info->root.splt->output_section->vma); value -= _bfd_get_gp_value (output_bfd); /* All PLTOFF relocations are basically the same at this point, |