aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-02-08 13:52:22 -0800
committerH.J. Lu <hjl.tools@gmail.com>2018-02-08 13:52:22 -0800
commitdc11dea21281758b71113c03a8d8be92d175a46c (patch)
treee6609a1cee822e17dbf2e95312ab33f72e8666c7 /bfd/elf64-x86-64.c
parent3f48fe4a95ec0e67b81d5d606762c91ad9a6b799 (diff)
downloadgdb-dc11dea21281758b71113c03a8d8be92d175a46c.zip
gdb-dc11dea21281758b71113c03a8d8be92d175a46c.tar.gz
gdb-dc11dea21281758b71113c03a8d8be92d175a46c.tar.bz2
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.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index aad9b85..7fa0408 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -27,6 +27,9 @@
#include "opcode/i386.h"
#include "elf/x86-64.h"
+static bfd_boolean elf64_x86_64_copy_solaris_special_section_fields
+ (const bfd *, bfd *, const Elf_Internal_Shdr *, Elf_Internal_Shdr *);
+
#ifdef CORE_HEADER
#include <stdarg.h>
#include CORE_HEADER
@@ -4858,6 +4861,7 @@ static bfd *
elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
{
struct elf_x86_init_table init_table;
+ const struct elf_backend_data *bed;
if ((int) R_X86_64_standard >= (int) R_X86_64_converted_reloc_bit
|| (int) R_X86_64_max <= (int) R_X86_64_converted_reloc_bit
@@ -4914,6 +4918,11 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
init_table.r_sym = elf32_r_sym;
}
+ bed = get_elf_backend_data (info->output_bfd);
+ init_table.need_global_offset_table
+ = (bed->elf_backend_copy_special_section_fields
+ == elf64_x86_64_copy_solaris_special_section_fields);
+
return _bfd_x86_elf_link_setup_gnu_properties (info, &init_table);
}