mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
233a00833b
Add -z cet-report=[none|warning|error] to report the missing Intel Indirect Branch Tracking (IBT) and Shadow Stack (SHSTK) properties in input .note.gnu.property section. -z cet-report=none, which is the default, will make the linker not report missing properties in input files. -z cet-report=warning will make the linker issue a warning for missing properties in input files. -z cet-report=error will make the linker issue an error for missing properties in input files. Note that -z ibt will turn off the missing IBT property report and -z shstk will turn off the missing SHSTK property report. Supported for Linux/i386 and Linux/x86_64. bfd/ * elf-linker-x86.h (elf_x86_cet_report): New. (elf_linker_x86_params): Add cet_report. * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report missing IBT and SHSTK properties if needed. ld/ * ld.texi: Document -z cet-report=[none|warning|error]. * emulparams/cet.sh: Add -z cet-report=[none|warning|error]. * testsuite/ld-i386/i386.exp: Run -z cet-report=[warning|error] tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/property-x86-cet1.d: New file. * testsuite/ld-i386/property-x86-cet2a.d: Likewise. * testsuite/ld-i386/property-x86-cet2b.d: Likewise. * testsuite/ld-i386/property-x86-cet3a.d: Likewise. * testsuite/ld-i386/property-x86-cet3b.d: Likewise. * testsuite/ld-i386/property-x86-cet4a.d: Likewise. * testsuite/ld-i386/property-x86-cet4b.d: Likewise. * testsuite/ld-i386/property-x86-cet5a.d: Likewise. * testsuite/ld-i386/property-x86-cet5b.d: Likewise. * testsuite/ld-i386/property-x86-cet6.d: Likewise. * testsuite/ld-x86-64/property-x86-cet.s: Likewise. * testsuite/ld-x86-64/property-x86-cet1-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet1.d: Likewise. * testsuite/ld-x86-64/property-x86-cet2a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet2a.d: Likewise. * testsuite/ld-x86-64/property-x86-cet2b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet2b.d: Likewise. * testsuite/ld-x86-64/property-x86-cet3a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet3a.d: Likewise. * testsuite/ld-x86-64/property-x86-cet3b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet3b.d: Likewise. * testsuite/ld-x86-64/property-x86-cet4a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet4a.d: Likewise. * testsuite/ld-x86-64/property-x86-cet4b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet4b.d: Likewise. * testsuite/ld-x86-64/property-x86-cet5a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet5a.d: Likewise. * testsuite/ld-x86-64/property-x86-cet5b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet5b.d: Likewise. * testsuite/ld-x86-64/property-x86-cet6-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet6.d: Likewise.
61 lines
2.2 KiB
C
61 lines
2.2 KiB
C
/* x86-specific ELF linker support between ld and bfd.
|
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
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. */
|
|
|
|
/* Missing IBT and SHSTK property report control. */
|
|
enum elf_x86_cet_report
|
|
{
|
|
cet_report_none = 0, /* Do nothing. */
|
|
cet_report_warning = 1 << 0, /* Issue a warning. */
|
|
cet_report_error = 1 << 1, /* Issue an error. */
|
|
cet_report_ibt = 1 << 2, /* Report missing IBT property. */
|
|
cet_report_shstk = 1 << 3 /* Report missing SHSTK property. */
|
|
};
|
|
|
|
/* Used to pass x86-specific linker options from ld to bfd. */
|
|
struct elf_linker_x86_params
|
|
{
|
|
/* TRUE if BND prefix in PLT entries is always generated. */
|
|
unsigned int bndplt: 1;
|
|
|
|
/* TRUE if IBT-enabled PLT entries should be generated. */
|
|
unsigned int ibtplt: 1;
|
|
|
|
/* TRUE if GNU_PROPERTY_X86_FEATURE_1_IBT should be generated. */
|
|
unsigned int ibt: 1;
|
|
|
|
/* TRUE if GNU_PROPERTY_X86_FEATURE_1_SHSTK should be generated. */
|
|
unsigned int shstk: 1;
|
|
|
|
/* TRUE if we shouldn't check relocation overflow. */
|
|
unsigned int no_reloc_overflow_check: 1;
|
|
|
|
/* TRUE if generate a 1-byte NOP as suffix for x86 call instruction. */
|
|
unsigned int call_nop_as_suffix : 1;
|
|
|
|
/* Report missing IBT and SHSTK properties. */
|
|
enum elf_x86_cet_report cet_report;
|
|
|
|
/* The 1-byte NOP for x86 call instruction. */
|
|
char call_nop_byte;
|
|
};
|
|
|
|
extern void _bfd_elf_linker_x86_set_options
|
|
(struct bfd_link_info *, struct elf_linker_x86_params *);
|