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.
39 lines
1.4 KiB
Bash
39 lines
1.4 KiB
Bash
PARSE_AND_LIST_OPTIONS_CET='
|
|
fprintf (file, _("\
|
|
-z ibtplt Generate IBT-enabled PLT entries\n"));
|
|
fprintf (file, _("\
|
|
-z ibt Generate GNU_PROPERTY_X86_FEATURE_1_IBT\n"));
|
|
fprintf (file, _("\
|
|
-z shstk Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK\n"));
|
|
fprintf (file, _("\
|
|
-z cet-report=[none|warning|error] (default: none)\n\
|
|
Report missing IBT and SHSTK properties\n"));
|
|
'
|
|
PARSE_AND_LIST_ARGS_CASE_Z_CET='
|
|
else if (strcmp (optarg, "ibtplt") == 0)
|
|
params.ibtplt = TRUE;
|
|
else if (strcmp (optarg, "ibt") == 0)
|
|
params.ibt = TRUE;
|
|
else if (strcmp (optarg, "shstk") == 0)
|
|
params.shstk = TRUE;
|
|
else if (strncmp (optarg, "cet-report=", 11) == 0)
|
|
{
|
|
if (strcmp (optarg + 11, "none") == 0)
|
|
params.cet_report = cet_report_none;
|
|
else if (strcmp (optarg + 11, "warning") == 0)
|
|
params.cet_report = (cet_report_warning
|
|
| cet_report_ibt
|
|
| cet_report_shstk);
|
|
else if (strcmp (optarg + 11, "error") == 0)
|
|
params.cet_report = (cet_report_error
|
|
| cet_report_ibt
|
|
| cet_report_shstk);
|
|
else
|
|
einfo (_("%F%P: invalid option for -z cet-report=: %s\n"),
|
|
optarg + 11);
|
|
}
|
|
'
|
|
|
|
PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_CET"
|
|
PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_CET"
|