binutils-gdb/ld/emultempl/elf-x86.em
H.J. Lu f68c9d09a3 ld: Add --enable-mark-plt configure option
Add --enable-mark-plt linker configure option to mark PLT entries with
DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT dynamic tags by
default.

	* NEWS: Mention -z mark-plt/-z nomark-plt and --enable-mark-plt.
	* config.in: Regenerated.
	* configure: Likewise.
	* configure.ac: Add --enable-mark-plt.
	(DEFAULT_LD_Z_MARK_PLT): New AC_DEFINE_UNQUOTED.
	* emulparams/x86-64-plt.sh (PARSE_AND_LIST_OPTIONS_X86_64_PLT):
	Support DEFAULT_LD_Z_MARK_PLT.
	* emultempl/elf-x86.em (elf_x86_64_before_parse): New function.
	(LDEMUL_BEFORE_PARSE): New.  Set to elf_x86_64_before_parse for
	x86-64 targets.
2024-01-09 06:45:38 -08:00

76 lines
1.8 KiB
Plaintext

# This shell script emits a C file. -*- C -*-
# Copyright (C) 2019-2024 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 elf.em, and defines x86 specific routines.
#
fragment <<EOF
#include "ldlex.h"
#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
case x${OUTPUT_FORMAT}${CALL_NOP_BYTE} in
x*x86-64*0x67)
fragment <<EOF
static void
elf_x86_64_before_parse (void)
{
params.mark_plt = DEFAULT_LD_Z_MARK_PLT;
elf_x86_before_parse ();
}
EOF
LDEMUL_BEFORE_PARSE=elf_x86_64_before_parse
;;
esac