aboutsummaryrefslogtreecommitdiff
path: root/ld/emulparams
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-06-11 20:55:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2024-06-14 13:38:19 -0700
commit93548ee191ff95cae0592363b579c6addb0b151d (patch)
treeb8c1a0fdb54efbfe148ee1af30c78c1137adf416 /ld/emulparams
parent65e513dc95dcad1320c6bee4be1a10ed46f7d2cb (diff)
downloadgdb-93548ee191ff95cae0592363b579c6addb0b151d.zip
gdb-93548ee191ff95cae0592363b579c6addb0b151d.tar.gz
gdb-93548ee191ff95cae0592363b579c6addb0b151d.tar.bz2
x86: Add -z isa-level-report=[none|all|needed|used]
Add -z isa-level-report=[none|all|needed|used] to the x86 ELF linker to report needed and used x86-64 ISA levels. bfd/ PR ld/31868 * elf-linker-x86.h (elf_x86_isa_level_report): New. (elf_linker_x86_params): Add isa_level_report. * elfxx-x86.c (report_isa_level): New. (_bfd_x86_elf_link_setup_gnu_properties): Check -z isa-level-report=[none|all|needed|used] to report needed and used x86-64 ISA level. ld/ PR ld/31868 * NEWS: Mention -z isa-level-report=[none|all|needed|used]. * ld.texi: Document -z isa-level-report=[none|all|needed|used]. * emulparams/elf32_x86_64.sh: Source x86-64-level-report.sh. * emulparams/elf_i386.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emulparams/x86-64-level-report.sh: New file. * testsuite/ld-i386/pr31868a.d: Likewise. * testsuite/ld-i386/pr31868b.d: Likewise. * testsuite/ld-i386/pr31868c.d: Likewise. * testsuite/ld-x86-64/pr31868a-x32.d: Likewise. * testsuite/ld-x86-64/pr31868a.d: Likewise. * testsuite/ld-x86-64/pr31868a.l: Likewise. * testsuite/ld-x86-64/pr31868a.s: Likewise. * testsuite/ld-x86-64/pr31868b-x32.d: Likewise. * testsuite/ld-x86-64/pr31868b.d: Likewise. * testsuite/ld-x86-64/pr31868b.l: Likewise. * testsuite/ld-x86-64/pr31868b.s: Likewise. * testsuite/ld-x86-64/pr31868c-x32.d: Likewise. * testsuite/ld-x86-64/pr31868c.d: Likewise. * testsuite/ld-x86-64/pr31868c.l: Likewise. * testsuite/ld-i386/i386.exp: Run PR ld/31868 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'ld/emulparams')
-rw-r--r--ld/emulparams/elf32_x86_64.sh1
-rw-r--r--ld/emulparams/elf_i386.sh1
-rw-r--r--ld/emulparams/elf_x86_64.sh1
-rw-r--r--ld/emulparams/x86-64-level-report.sh25
4 files changed, 28 insertions, 0 deletions
diff --git a/ld/emulparams/elf32_x86_64.sh b/ld/emulparams/elf32_x86_64.sh
index f6c6de9..6a92eec 100644
--- a/ld/emulparams/elf32_x86_64.sh
+++ b/ld/emulparams/elf32_x86_64.sh
@@ -6,6 +6,7 @@ source_sh ${srcdir}/emulparams/call_nop.sh
source_sh ${srcdir}/emulparams/cet.sh
source_sh ${srcdir}/emulparams/x86-report-relative.sh
source_sh ${srcdir}/emulparams/x86-64-level.sh
+source_sh ${srcdir}/emulparams/x86-64-level-report.sh
source_sh ${srcdir}/emulparams/x86-64-plt.sh
source_sh ${srcdir}/emulparams/static.sh
source_sh ${srcdir}/emulparams/dt-relr.sh
diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
index 3f12435..6f698bb 100644
--- a/ld/emulparams/elf_i386.sh
+++ b/ld/emulparams/elf_i386.sh
@@ -5,6 +5,7 @@ source_sh ${srcdir}/emulparams/call_nop.sh
source_sh ${srcdir}/emulparams/cet.sh
source_sh ${srcdir}/emulparams/x86-report-relative.sh
source_sh ${srcdir}/emulparams/x86-64-level.sh
+source_sh ${srcdir}/emulparams/x86-64-level-report.sh
source_sh ${srcdir}/emulparams/static.sh
source_sh ${srcdir}/emulparams/dt-relr.sh
SCRIPT_NAME=elf
diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh
index 466da2c..9244974 100644
--- a/ld/emulparams/elf_x86_64.sh
+++ b/ld/emulparams/elf_x86_64.sh
@@ -6,6 +6,7 @@ source_sh ${srcdir}/emulparams/call_nop.sh
source_sh ${srcdir}/emulparams/cet.sh
source_sh ${srcdir}/emulparams/x86-report-relative.sh
source_sh ${srcdir}/emulparams/x86-64-level.sh
+source_sh ${srcdir}/emulparams/x86-64-level-report.sh
source_sh ${srcdir}/emulparams/x86-64-lam.sh
source_sh ${srcdir}/emulparams/x86-64-plt.sh
source_sh ${srcdir}/emulparams/static.sh
diff --git a/ld/emulparams/x86-64-level-report.sh b/ld/emulparams/x86-64-level-report.sh
new file mode 100644
index 0000000..5185277
--- /dev/null
+++ b/ld/emulparams/x86-64-level-report.sh
@@ -0,0 +1,25 @@
+PARSE_AND_LIST_OPTIONS_X86_64_LEVEL_REPORT='
+ fprintf (file, _("\
+ -z isa-level-report=[none|all|needed|used] (default: none)\n\
+ Report x86-64 ISA level\n"));
+'
+PARSE_AND_LIST_ARGS_CASE_Z_X86_64_LEVEL_REPORT='
+ else if (strncmp (optarg, "isa-level-report=", 17) == 0)
+ {
+ if (strcmp (optarg + 17, "none") == 0)
+ params.isa_level_report = isa_level_report_none;
+ else if (strcmp (optarg + 17, "all") == 0)
+ params.isa_level_report = (isa_level_report_needed
+ | isa_level_report_used);
+ else if (strcmp (optarg + 17, "needed") == 0)
+ params.isa_level_report = isa_level_report_needed;
+ else if (strcmp (optarg + 17, "used") == 0)
+ params.isa_level_report = isa_level_report_used;
+ else
+ einfo (_("%F%P: invalid option for -z isa-level-report=: %s\n"),
+ optarg + 17);
+ }
+'
+
+PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_X86_64_LEVEL_REPORT"
+PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_X86_64_LEVEL_REPORT"