From: Alan Modra Date: Tue, 5 Nov 2013 02:08:51 +0000 (+1030) Subject: Hide ppc64 .TOC. from --export-dynamic X-Git-Tag: binutils-2_24~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3943c5e736b0efccbdc881ddfe589ff86d7e78e2;p=thirdparty%2Fbinutils-gdb.git Hide ppc64 .TOC. from --export-dynamic (cherry picked from commit dba6fa9bce92c9f9fcca07269ac8443797bd9338) --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8401292872c..fd128199dd2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,11 @@ 2013-11-15 Alan Modra Apply changes from mainline to 2.24 + 2013-11-05 Alan Modra + * elf64-ppc.c (ppc64_elf_func_desc_adjust): Make .TOC. defined and + hidden. + (ppc64_elf_set_toc): Adjust. + 2013-11-05 Alan Modra * elf64-ppc.c (struct ppc_link_hash_table): Remove got, plt, relplt, iplt, reliplt. Update all references to use elf.sgot, elf.splt, diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index adc285f4876..136887f25e2 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -6837,7 +6837,18 @@ ppc64_elf_func_desc_adjust (bfd *obfd ATTRIBUTE_UNUSED, if (!info->relocatable && htab->elf.hgot != NULL) - _bfd_elf_link_hash_hide_symbol (info, htab->elf.hgot, TRUE); + { + _bfd_elf_link_hash_hide_symbol (info, htab->elf.hgot, TRUE); + /* Make .TOC. defined so as to prevent it being made dynamic. + The wrong value here is fixed later in ppc64_elf_set_toc. */ + htab->elf.hgot->type = STT_OBJECT; + htab->elf.hgot->root.type = bfd_link_hash_defined; + htab->elf.hgot->root.u.def.value = 0; + htab->elf.hgot->root.u.def.section = bfd_abs_section_ptr; + htab->elf.hgot->def_regular = 1; + htab->elf.hgot->other = ((htab->elf.hgot->other & ~ELF_ST_VISIBILITY (-1)) + | STV_HIDDEN); + } if (htab->sfpr == NULL) /* We don't have any relocs. */ @@ -12329,8 +12340,6 @@ ppc64_elf_set_toc (struct bfd_link_info *info, bfd *obfd) if (htab != NULL && htab->elf.hgot != NULL) { - htab->elf.hgot->type = STT_OBJECT; - htab->elf.hgot->root.type = bfd_link_hash_defined; htab->elf.hgot->root.u.def.value = TOC_BASE_OFF; htab->elf.hgot->root.u.def.section = s; }