From dc11dea21281758b71113c03a8d8be92d175a46c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 8 Feb 2018 13:52:22 -0800 Subject: x86: Keep the unused _GLOBAL_OFFSET_TABLE_ for Solaris Solaris requires to keep _GLOBAL_OFFSET_TABLE_ even if it isn't used. This patch detects Solaris target and keeps _GLOBAL_OFFSET_TABLE_ for Solaris. * elf32-i386.c (elf32_i386_copy_solaris_special_section_fields): New prototype. (elf_i386_link_setup_gnu_properties): Set need_global_offset_table for Solaris. * elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields): New prototype. (elf_x86_64_link_setup_gnu_properties): Set need_global_offset_table for Solaris. * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Keep the unused _GLOBAL_OFFSET_TABLE_ for Solaris. (_bfd_x86_elf_link_setup_gnu_properties): Copy need_global_offset_table. * elfxx-x86.h (elf_x86_link_hash_table): Add need_global_offset_table. (elf_x86_init_table): Likewise. --- bfd/elfxx-x86.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bfd/elfxx-x86.c') diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index dbda542..b0eb1c8 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -1098,7 +1098,8 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, || htab->elf.igotplt->size == 0)) { htab->elf.sgotplt->size = 0; - if (htab->elf.hgot != NULL) + if (htab->elf.hgot != NULL + && !htab->need_global_offset_table) { /* Remove the unused _GLOBAL_OFFSET_TABLE_ from symbol table. */ @@ -2463,6 +2464,7 @@ error_alignment: return pbfd; htab->plt0_pad_byte = init_table->plt0_pad_byte; + htab->need_global_offset_table = init_table->need_global_offset_table; use_ibt_plt = info->ibtplt || info->ibt; if (!use_ibt_plt && pbfd != NULL) -- cgit v1.1