diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d2b5a57fe78..cc82ff16426 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2018-10-04 Jose E. Marchesi + + * elf64-sparc.c (elf64_sparc_output_arch_syms): Do notcorrect the + impact of STT_REGISTER symbols in the dynsym sh_index here... + * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_sections): ...but + do it here. + 2018-10-03 H.J. Lu PR ld/23658 diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 41e1b7acf7e..958ce44690e 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -582,29 +582,6 @@ elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED, _bfd_sparc_elf_hash_table(info)->app_regs; Elf_Internal_Sym sym; - /* We arranged in size_dynamic_sections to put the STT_REGISTER entries - at the end of the dynlocal list, so they came at the end of the local - symbols in the symtab. Except that they aren't STB_LOCAL, so we need - to back up symtab->sh_info. */ - if (elf_hash_table (info)->dynlocal) - { - bfd * dynobj = elf_hash_table (info)->dynobj; - asection *dynsymsec = bfd_get_linker_section (dynobj, ".dynsym"); - struct elf_link_local_dynamic_entry *e; - - for (e = elf_hash_table (info)->dynlocal; e ; e = e->next) - if (e->input_indx == -1) - break; - if (e) - { - elf_section_data (dynsymsec->output_section)->this_hdr.sh_info - = e->dynindx; - } - } - - if (info->strip == strip_all) - return TRUE; - for (reg = 0; reg < 4; reg++) if (app_regs [reg].name != NULL) { diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index bf143c400f4..e5430fd55de 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -4792,7 +4792,25 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i htab = _bfd_sparc_elf_hash_table (info); BFD_ASSERT (htab != NULL); dynobj = htab->elf.dynobj; - + + /* We arranged in size_dynamic_sections to put the STT_REGISTER + entries at the end of the dynlocal list, so they came at the end + of the local symbols in the symtab. Except that they aren't + STB_LOCAL, so we need to back up symtab->sh_info. */ + if (ABI_64_P (output_bfd) + && elf_hash_table (info)->dynlocal) + { + asection *dynsymsec = bfd_get_linker_section (dynobj, ".dynsym"); + struct elf_link_local_dynamic_entry *e; + + for (e = elf_hash_table (info)->dynlocal; e ; e = e->next) + if (e->input_indx == -1) + break; + if (e) + elf_section_data (dynsymsec->output_section)->this_hdr.sh_info + = e->dynindx; + } + sdyn = bfd_get_linker_section (dynobj, ".dynamic"); if (elf_hash_table (info)->dynamic_sections_created)