aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-08-13 00:03:43 +0930
committerAlan Modra <amodra@gmail.com>2016-08-13 00:07:20 +0930
commit90ac242072dc68ad454aaaa228868b0f1c8e10f9 (patch)
tree1643c10d5f8eca4f8b2615fef2b7446cd9f36007 /bfd/elflink.c
parentb14bdb3bab20db9d200d669dfb5e2eadde7b14cc (diff)
downloadgdb-90ac242072dc68ad454aaaa228868b0f1c8e10f9.zip
gdb-90ac242072dc68ad454aaaa228868b0f1c8e10f9.tar.gz
gdb-90ac242072dc68ad454aaaa228868b0f1c8e10f9.tar.bz2
Correct .dynsym sh_info
bfd/ * elf-bfd.h (struct elf_link_hash_table): Add local_dynsymcount. * elflink.c (_bfd_elf_link_renumber_dynsyms): Set local_dynsymcount. (bfd_elf_final_link): Set .dynsym sh_info from local_dynsymcount. ld/ * testsuite/ld-tic6x/shlib-1.rd: Correct expected .dynsym sh_info. * testsuite/ld-tic6x/shlib-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-1rb.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise. * testsuite/ld-tic6x/shlib-noindex.rd: Likewise. * testsuite/ld-tic6x/static-app-1.rd: Likewise. * testsuite/ld-tic6x/static-app-1b.rd: Likewise. * testsuite/ld-tic6x/static-app-1r.rd: Likewise. * testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 5bc5740..9e9a33c 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -904,6 +904,7 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd,
for (p = elf_hash_table (info)->dynlocal; p ; p = p->next)
p->dynindx = ++dynsymcount;
}
+ elf_hash_table (info)->local_dynsymcount = dynsymcount;
elf_link_hash_traverse (elf_hash_table (info),
elf_link_renumber_hash_table_dynsyms,
@@ -11781,7 +11782,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
Elf_Internal_Sym sym;
bfd_byte *dynsym = elf_hash_table (info)->dynsym->contents;
- long last_local = 0;
+
+ o = elf_hash_table (info)->dynsym->output_section;
+ elf_section_data (o)->this_hdr.sh_info
+ = elf_hash_table (info)->local_dynsymcount + 1;
/* Write out the section symbols for the output sections. */
if (bfd_link_pic (info)
@@ -11811,8 +11815,6 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
return FALSE;
sym.st_value = s->vma;
dest = dynsym + dynindx * bed->s->sizeof_sym;
- if (last_local < dynindx)
- last_local = dynindx;
bed->s->swap_symbol_out (abfd, &sym, dest, 0);
}
}
@@ -11845,16 +11847,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
+ e->isym.st_value);
}
- if (last_local < e->dynindx)
- last_local = e->dynindx;
-
dest = dynsym + e->dynindx * bed->s->sizeof_sym;
bed->s->swap_symbol_out (abfd, &sym, dest, 0);
}
}
-
- elf_section_data (elf_hash_table (info)->dynsym->output_section)->this_hdr.sh_info =
- last_local + 1;
}
/* We get the global symbols from the hash table. */