diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-04-17 07:47:17 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-04-17 07:47:32 -0700 |
commit | e6699019c4f363f804f9646974ab1d5e78785ffc (patch) | |
tree | 1e81c7c4cb6760c4115f4ab0b9cb0d2ef970629e /bfd/elflink.c | |
parent | 305d16a9beff2a817ee03b3881da68eb3a29edec (diff) | |
download | gdb-e6699019c4f363f804f9646974ab1d5e78785ffc.zip gdb-e6699019c4f363f804f9646974ab1d5e78785ffc.tar.gz gdb-e6699019c4f363f804f9646974ab1d5e78785ffc.tar.bz2 |
Put soname in the version definition section
commit 902e9fc76a0ec9f642cefa71ef88cca1c675ad54
Author: Maciej W. Rozycki <macro@imgtec.com>
Date: Tue Feb 21 01:46:42 2017 +0000
PR ld/20828: Move symbol version processing ahead of GC symbol sweep
breaks version definition with --version-script --soname. This patch
fixes it by getting soname index before generating the version definition
section.
bfd/
PR ld/21389
* elflink.c (bfd_elf_size_dynamic_sections): Get soname index
before generating the version definition section.
ld/
PR ld/21389
* testsuite/ld-elf/pr21389.map: New file.
* testsuite/ld-elf/pr21389.s: Likewise.
* testsuite/ld-elf/pr21389a.d: Likewise.
* testsuite/ld-elf/pr21389b.d: Likewise.
* testsuite/ld-elf/pr21389c.d: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index ec2032b..b93d4f3 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -5948,14 +5948,11 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info, asection **sinterpptr) { - size_t soname_indx; bfd *dynobj; const struct elf_backend_data *bed; *sinterpptr = NULL; - soname_indx = (size_t) -1; - if (!is_elf_hash_table (info->hash)) return TRUE; @@ -5970,6 +5967,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, struct elf_info_failed eif; bfd_boolean all_defined; asection *s; + size_t soname_indx; eif.info = info; eif.failed = FALSE; @@ -5986,6 +5984,17 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, return FALSE; } + if (soname != NULL) + { + soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, + soname, TRUE); + if (soname_indx == (size_t) -1 + || !_bfd_elf_add_dynamic_entry (info, DT_SONAME, soname_indx)) + return FALSE; + } + else + soname_indx = (size_t) -1; + /* Make all global versions with definition. */ for (t = info->version_info; t != NULL; t = t->next) for (d = t->globals.list; d != NULL; d = d->next) @@ -6494,15 +6503,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, *sinterpptr = bfd_get_linker_section (dynobj, ".interp"); BFD_ASSERT (*sinterpptr != NULL || !bfd_link_executable (info) || info->nointerp); - if (soname != NULL) - { - soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, - soname, TRUE); - if (soname_indx == (size_t) -1 - || !_bfd_elf_add_dynamic_entry (info, DT_SONAME, soname_indx)) - return FALSE; - } - if (info->symbolic) { if (!_bfd_elf_add_dynamic_entry (info, DT_SYMBOLIC, 0)) |