aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2019-04-06 07:25:10 -0700
committerH.J. Lu <hjl.tools@gmail.com>2019-04-06 07:25:31 -0700
commit5b9c07b2782fb9368f06c2561b7329c384ec5da0 (patch)
tree7258bdae0c83c09117cd939b2e770521c5604dc6 /ld
parentd55e5aa6b29906346c51ad00e6a9b112590aa294 (diff)
downloadgdb-5b9c07b2782fb9368f06c2561b7329c384ec5da0.zip
gdb-5b9c07b2782fb9368f06c2561b7329c384ec5da0.tar.gz
gdb-5b9c07b2782fb9368f06c2561b7329c384ec5da0.tar.bz2
x86: Move x86-specific linker options to elf_linker_x86_params
Remove x86-specific linker options from bfd_link_info and put them in elf_linker_x86_params. Add _bfd_elf_linker_x86_set_options to pass x86-specific linker options from ld to bfd. bfd/ * elf-linker-x86.h: New file. * elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params to get x86-specific linker options. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise. (_bfd_x86_elf_link_setup_gnu_properties): Likewise. (_bfd_elf_linker_x86_set_options): New function. * elfxx-x86.h: Include "elf-linker-x86.h". (elf_x86_link_hash_table): Add params. include/ * bfdlink.h (bfd_link_info): Remove x86-specific linker options. ld/ * Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em. (eelf_i386_sol2.c): Also depend on $(srcdir)/emultempl/solaris2-x86.em. (eelf_x86_64_sol2.c): Likewise. * Makefile.in: Regenerated. * emulparams/call_nop.sh: Set x86-specific linker options via params. * emulparams/cet.sh: Likewise. * emulparams/reloc_overflow.sh: Likewise. * emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New. Set to "elf-x86". * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to "solaris2-x86". * emulparams/elf_x86_64_sol2.sh: Likewise. * emultempl/elf-x86.em: New file. * emultempl/solaris2-x86.em: Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't set link_info.call_nop_byte.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog30
-rw-r--r--ld/Makefile.am5
-rw-r--r--ld/Makefile.in5
-rw-r--r--ld/emulparams/call_nop.sh16
-rw-r--r--ld/emulparams/cet.sh6
-rw-r--r--ld/emulparams/elf32_x86_64.sh1
-rw-r--r--ld/emulparams/elf_i386.sh1
-rw-r--r--ld/emulparams/elf_i386_be.sh1
-rw-r--r--ld/emulparams/elf_i386_chaos.sh1
-rw-r--r--ld/emulparams/elf_i386_ldso.sh1
-rw-r--r--ld/emulparams/elf_i386_sol2.sh2
-rw-r--r--ld/emulparams/elf_i386_vxworks.sh1
-rw-r--r--ld/emulparams/elf_iamcu.sh1
-rw-r--r--ld/emulparams/elf_k1om.sh1
-rw-r--r--ld/emulparams/elf_l1om.sh1
-rw-r--r--ld/emulparams/elf_x86_64.sh3
-rw-r--r--ld/emulparams/elf_x86_64_sol2.sh2
-rw-r--r--ld/emulparams/reloc_overflow.sh2
-rw-r--r--ld/emultempl/elf-x86.em57
-rw-r--r--ld/emultempl/elf32.em1
-rw-r--r--ld/emultempl/solaris2-x86.em23
21 files changed, 143 insertions, 18 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3beaa41..88044d1 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,33 @@
+2019-04-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em.
+ (eelf_i386_sol2.c): Also depend on
+ $(srcdir)/emultempl/solaris2-x86.em.
+ (eelf_x86_64_sol2.c): Likewise.
+ * Makefile.in: Regenerated.
+ * emulparams/call_nop.sh: Set x86-specific linker options via
+ params.
+ * emulparams/cet.sh: Likewise.
+ * emulparams/reloc_overflow.sh: Likewise.
+ * emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New. Set to
+ "elf-x86".
+ * emulparams/elf_i386.sh: Likewise.
+ * emulparams/elf_i386_be.sh: Likewise.
+ * emulparams/elf_i386_chaos.sh: Likewise.
+ * emulparams/elf_i386_ldso.sh: Likewise.
+ * emulparams/elf_i386_vxworks.sh: Likewise.
+ * emulparams/elf_iamcu.sh: Likewise.
+ * emulparams/elf_k1om.sh: Likewise.
+ * emulparams/elf_l1om.sh: Likewise.
+ * emulparams/elf_x86_64.sh: Likewise.
+ * emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to
+ "solaris2-x86".
+ * emulparams/elf_x86_64_sol2.sh: Likewise.
+ * emultempl/elf-x86.em: New file.
+ * emultempl/solaris2-x86.em: Likewise.
+ * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't
+ set link_info.call_nop_byte.
+
2019-04-05 Alan Modra <amodra@gmail.com>
* testsuite/ld-powerpc/tlsexe32.d: Remove trailing spaces.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index c2c798b..6d750c8 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -618,7 +618,8 @@ GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}"
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
ELF_DEPS = $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/scripttempl/DWARF.sc
ELF_GEN_DEPS = $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/emultempl/genelf.em $(srcdir)/scripttempl/DWARF.sc
-ELF_X86_DEPS = $(ELF_DEPS) $(srcdir)/emulparams/plt_unwind.sh \
+ELF_X86_DEPS = $(ELF_DEPS) $(srcdir)/emultempl/elf-x86.em \
+ $(srcdir)/emulparams/plt_unwind.sh \
$(srcdir)/emulparams/extern_protected_data.sh \
$(srcdir)/emulparams/dynamic_undefined_weak.sh \
$(srcdir)/emulparams/reloc_overflow.sh \
@@ -1310,6 +1311,7 @@ eelf_i386_nacl.c: $(srcdir)/emulparams/elf_i386_nacl.sh \
eelf_i386_sol2.c: $(srcdir)/emulparams/elf_i386_sol2.sh \
$(srcdir)/emulparams/solaris2.sh \
$(srcdir)/emultempl/solaris2.em \
+ $(srcdir)/emultempl/solaris2-x86.em \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \
@@ -1866,6 +1868,7 @@ eelf_x86_64_sol2.c: $(srcdir)/emulparams/elf_x86_64_sol2.sh \
$(srcdir)/emulparams/elf_x86_64.sh \
$(srcdir)/emulparams/solaris2.sh \
$(srcdir)/emultempl/solaris2.em \
+ $(srcdir)/emultempl/solaris2-x86.em \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
ehppa64linux.c: $(srcdir)/emulparams/hppa64linux.sh \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index fc687fc..0f3c11a 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -986,7 +986,8 @@ GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}"
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
ELF_DEPS = $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/scripttempl/DWARF.sc
ELF_GEN_DEPS = $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/emultempl/genelf.em $(srcdir)/scripttempl/DWARF.sc
-ELF_X86_DEPS = $(ELF_DEPS) $(srcdir)/emulparams/plt_unwind.sh \
+ELF_X86_DEPS = $(ELF_DEPS) $(srcdir)/emultempl/elf-x86.em \
+ $(srcdir)/emulparams/plt_unwind.sh \
$(srcdir)/emulparams/extern_protected_data.sh \
$(srcdir)/emulparams/dynamic_undefined_weak.sh \
$(srcdir)/emulparams/reloc_overflow.sh \
@@ -2914,6 +2915,7 @@ eelf_i386_nacl.c: $(srcdir)/emulparams/elf_i386_nacl.sh \
eelf_i386_sol2.c: $(srcdir)/emulparams/elf_i386_sol2.sh \
$(srcdir)/emulparams/solaris2.sh \
$(srcdir)/emultempl/solaris2.em \
+ $(srcdir)/emultempl/solaris2-x86.em \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \
@@ -3470,6 +3472,7 @@ eelf_x86_64_sol2.c: $(srcdir)/emulparams/elf_x86_64_sol2.sh \
$(srcdir)/emulparams/elf_x86_64.sh \
$(srcdir)/emulparams/solaris2.sh \
$(srcdir)/emultempl/solaris2.em \
+ $(srcdir)/emultempl/solaris2-x86.em \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
ehppa64linux.c: $(srcdir)/emulparams/hppa64linux.sh \
diff --git a/ld/emulparams/call_nop.sh b/ld/emulparams/call_nop.sh
index c114e95..b1e2e73 100644
--- a/ld/emulparams/call_nop.sh
+++ b/ld/emulparams/call_nop.sh
@@ -7,31 +7,31 @@ PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP='
{
if (strcmp (optarg + 9, "prefix-addr") == 0)
{
- link_info.call_nop_as_suffix = FALSE;
- link_info.call_nop_byte = 0x67;
+ params.call_nop_as_suffix = FALSE;
+ params.call_nop_byte = 0x67;
}
else if (strcmp (optarg + 9, "suffix-nop") == 0)
{
- link_info.call_nop_as_suffix = TRUE;
- link_info.call_nop_byte = 0x90;
+ params.call_nop_as_suffix = TRUE;
+ params.call_nop_byte = 0x90;
}
else if (strncmp (optarg + 9, "prefix-", 7) == 0)
{
char *end;
- link_info.call_nop_byte = strtoul (optarg + 16 , &end, 0);
+ params.call_nop_byte = strtoul (optarg + 16 , &end, 0);
if (*end)
einfo (_("%F%P: invalid number for -z call-nop=prefix-: %s\n"),
optarg + 16);
- link_info.call_nop_as_suffix = FALSE;
+ params.call_nop_as_suffix = FALSE;
}
else if (strncmp (optarg + 9, "suffix-", 7) == 0)
{
char *end;
- link_info.call_nop_byte = strtoul (optarg + 16, &end, 0);
+ params.call_nop_byte = strtoul (optarg + 16, &end, 0);
if (*end)
einfo (_("%F%P: invalid number for -z call-nop=suffix-: %s\n"),
optarg + 16);
- link_info.call_nop_as_suffix = TRUE;
+ params.call_nop_as_suffix = TRUE;
}
else
einfo (_("%F%P: unsupported option: -z %s\n"), optarg);
diff --git a/ld/emulparams/cet.sh b/ld/emulparams/cet.sh
index 7c49b95..1d45b16 100644
--- a/ld/emulparams/cet.sh
+++ b/ld/emulparams/cet.sh
@@ -8,11 +8,11 @@ PARSE_AND_LIST_OPTIONS_CET='
'
PARSE_AND_LIST_ARGS_CASE_Z_CET='
else if (strcmp (optarg, "ibtplt") == 0)
- link_info.ibtplt = TRUE;
+ params.ibtplt = TRUE;
else if (strcmp (optarg, "ibt") == 0)
- link_info.ibt = TRUE;
+ params.ibt = TRUE;
else if (strcmp (optarg, "shstk") == 0)
- link_info.shstk = TRUE;
+ params.shstk = TRUE;
'
PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_CET"
diff --git a/ld/emulparams/elf32_x86_64.sh b/ld/emulparams/elf32_x86_64.sh
index 9ce6533..6fddf62 100644
--- a/ld/emulparams/elf32_x86_64.sh
+++ b/ld/emulparams/elf32_x86_64.sh
@@ -14,6 +14,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH="i386:x64-32"
MACHINE=
TEMPLATE_NAME=elf32
+EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
index 2cef106..5d3f71f 100644
--- a/ld/emulparams/elf_i386.sh
+++ b/ld/emulparams/elf_i386.sh
@@ -12,6 +12,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH=i386
MACHINE=
TEMPLATE_NAME=elf32
+EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
diff --git a/ld/emulparams/elf_i386_be.sh b/ld/emulparams/elf_i386_be.sh
index 70db443..8d4cffe 100644
--- a/ld/emulparams/elf_i386_be.sh
+++ b/ld/emulparams/elf_i386_be.sh
@@ -3,6 +3,7 @@
. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
+EXTRA_EM_FILE="elf-x86"
NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x80000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
diff --git a/ld/emulparams/elf_i386_chaos.sh b/ld/emulparams/elf_i386_chaos.sh
index aa36cb5..ec2bb7f 100644
--- a/ld/emulparams/elf_i386_chaos.sh
+++ b/ld/emulparams/elf_i386_chaos.sh
@@ -4,6 +4,7 @@
. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf_chaos
OUTPUT_FORMAT="elf32-i386"
+EXTRA_EM_FILE="elf-x86"
TEXT_START_ADDR=0x40000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=i386
diff --git a/ld/emulparams/elf_i386_ldso.sh b/ld/emulparams/elf_i386_ldso.sh
index 1328520..981c701 100644
--- a/ld/emulparams/elf_i386_ldso.sh
+++ b/ld/emulparams/elf_i386_ldso.sh
@@ -4,6 +4,7 @@
. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
+EXTRA_EM_FILE="elf-x86"
NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x08048000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
diff --git a/ld/emulparams/elf_i386_sol2.sh b/ld/emulparams/elf_i386_sol2.sh
index 7c18fc6..c45a586 100644
--- a/ld/emulparams/elf_i386_sol2.sh
+++ b/ld/emulparams/elf_i386_sol2.sh
@@ -1,4 +1,4 @@
. ${srcdir}/emulparams/elf_i386_ldso.sh
. ${srcdir}/emulparams/solaris2.sh
-EXTRA_EM_FILE=solaris2
+EXTRA_EM_FILE="solaris2-x86"
OUTPUT_FORMAT="elf32-i386-sol2"
diff --git a/ld/emulparams/elf_i386_vxworks.sh b/ld/emulparams/elf_i386_vxworks.sh
index aaea8c4..efc164f 100644
--- a/ld/emulparams/elf_i386_vxworks.sh
+++ b/ld/emulparams/elf_i386_vxworks.sh
@@ -7,6 +7,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH=i386
MACHINE=
TEMPLATE_NAME=elf32
+EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
diff --git a/ld/emulparams/elf_iamcu.sh b/ld/emulparams/elf_iamcu.sh
index d910b65..d30a155 100644
--- a/ld/emulparams/elf_iamcu.sh
+++ b/ld/emulparams/elf_iamcu.sh
@@ -12,6 +12,7 @@ ARCH=iamcu
MACHINE=
COMPILE_IN=yes
TEMPLATE_NAME=elf32
+EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
diff --git a/ld/emulparams/elf_k1om.sh b/ld/emulparams/elf_k1om.sh
index 494efcc..ec84bd0 100644
--- a/ld/emulparams/elf_k1om.sh
+++ b/ld/emulparams/elf_k1om.sh
@@ -13,6 +13,7 @@ ARCH="k1om"
MACHINE=
COMPILE_IN=yes
TEMPLATE_NAME=elf32
+EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
diff --git a/ld/emulparams/elf_l1om.sh b/ld/emulparams/elf_l1om.sh
index b115879..fade2da 100644
--- a/ld/emulparams/elf_l1om.sh
+++ b/ld/emulparams/elf_l1om.sh
@@ -13,6 +13,7 @@ ARCH="l1om"
MACHINE=
COMPILE_IN=yes
TEMPLATE_NAME=elf32
+EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh
index d8c6e54..241911d 100644
--- a/ld/emulparams/elf_x86_64.sh
+++ b/ld/emulparams/elf_x86_64.sh
@@ -14,6 +14,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH="i386:x86-64"
MACHINE=
TEMPLATE_NAME=elf32
+EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
@@ -47,7 +48,7 @@ case "$target" in
'
PARSE_AND_LIST_ARGS_CASE_Z_BNDPLT='
else if (strcmp (optarg, "bndplt") == 0)
- link_info.bndplt = TRUE;
+ params.bndplt = TRUE;
'
PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_BNDPLT"
PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_BNDPLT"
diff --git a/ld/emulparams/elf_x86_64_sol2.sh b/ld/emulparams/elf_x86_64_sol2.sh
index 993f458..3bd975f 100644
--- a/ld/emulparams/elf_x86_64_sol2.sh
+++ b/ld/emulparams/elf_x86_64_sol2.sh
@@ -1,4 +1,4 @@
. ${srcdir}/emulparams/elf_x86_64.sh
. ${srcdir}/emulparams/solaris2.sh
-EXTRA_EM_FILE=solaris2
+EXTRA_EM_FILE="solaris2-x86"
OUTPUT_FORMAT="elf64-x86-64-sol2"
diff --git a/ld/emulparams/reloc_overflow.sh b/ld/emulparams/reloc_overflow.sh
index 7ba0ee5..6bf0abc 100644
--- a/ld/emulparams/reloc_overflow.sh
+++ b/ld/emulparams/reloc_overflow.sh
@@ -4,7 +4,7 @@ PARSE_AND_LIST_OPTIONS_RELOC_OVERFLOW='
'
PARSE_AND_LIST_ARGS_CASE_Z_RELOC_OVERFLOW='
else if (strcmp (optarg, "noreloc-overflow") == 0)
- link_info.no_reloc_overflow_check = TRUE;
+ params.no_reloc_overflow_check = TRUE;
'
PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_RELOC_OVERFLOW"
diff --git a/ld/emultempl/elf-x86.em b/ld/emultempl/elf-x86.em
new file mode 100644
index 0000000..09780a1
--- /dev/null
+++ b/ld/emultempl/elf-x86.em
@@ -0,0 +1,57 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2019 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the license, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not,
+# see <http://www.gnu.org/licenses/>.
+#
+
+# This file is sourced from elf32.em, and defines x86 specific routines.
+#
+fragment <<EOF
+
+#include "elf-linker-x86.h"
+
+static struct elf_linker_x86_params params;
+
+/* This is a convenient point to tell BFD about target specific flags.
+ After the output has been created, but before inputs are read. */
+
+static void
+elf_x86_create_output_section_statements (void)
+{
+ _bfd_elf_linker_x86_set_options (&link_info, &params);
+}
+
+EOF
+
+LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=elf_x86_create_output_section_statements
+
+if test -n "$CALL_NOP_BYTE"; then
+
+fragment <<EOF
+
+static void
+elf_x86_before_parse (void)
+{
+ params.call_nop_byte = $CALL_NOP_BYTE;
+
+ gld${EMULATION_NAME}_before_parse ();
+}
+
+EOF
+
+LDEMUL_BEFORE_PARSE=elf_x86_before_parse
+fi
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index f4f7ad6..3e8ee46 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -103,7 +103,6 @@ gld${EMULATION_NAME}_before_parse (void)
input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
- `if test -n "$CALL_NOP_BYTE" ; then echo link_info.call_nop_byte = $CALL_NOP_BYTE; fi`;
link_info.check_relocs_after_open_input = TRUE;
link_info.relro = DEFAULT_LD_Z_RELRO;
link_info.separate_code = DEFAULT_LD_Z_SEPARATE_CODE;
diff --git a/ld/emultempl/solaris2-x86.em b/ld/emultempl/solaris2-x86.em
new file mode 100644
index 0000000..559cb8f
--- /dev/null
+++ b/ld/emultempl/solaris2-x86.em
@@ -0,0 +1,23 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2019 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+source_em "${srcdir}/emultempl/elf-x86.em"
+source_em "${srcdir}/emultempl/solaris2.em"