aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-12-23 13:00:39 -0800
committerH.J. Lu <hjl.tools@gmail.com>2020-12-23 13:00:55 -0800
commit279d901e5a7a16eb9a3383e316ff4a8d7473d6bd (patch)
treee88e5c81e28763605903e0971fa900a2a3a4308b /ld
parent5cc0917c387350c47c350843e3b7a16059345529 (diff)
downloadgdb-279d901e5a7a16eb9a3383e316ff4a8d7473d6bd.zip
gdb-279d901e5a7a16eb9a3383e316ff4a8d7473d6bd.tar.gz
gdb-279d901e5a7a16eb9a3383e316ff4a8d7473d6bd.tar.bz2
x86-64: Add Intel LAM property support
Add Intel Linear Address Masking (LAM) property support. LAM modifies the checking that is applied to 64-bit linear addresses, allowing software to use of the untranslated address bits for metadata. bfd/ * elf-linker-x86.h (elf_x86_cet_report): Renamed to ... (elf_x86_prop_report): This. (elf_linker_x86_params): Add lam_u48, lam_u57, lam_u48_report and lam_u57_report. * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Support GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and GNU_PROPERTY_X86_FEATURE_1_LAM_U57. (_bfd_x86_elf_link_fixup_gnu_properties): Keep LAM features only for 64-bit output. binutils/ * NEWS: Mention LAM_U48 and LAM_U57 support. * elfedit.c (elf_x86_feature): Support lam_u48 and lam_u57. (usage): Add lam_u48 and lam_u57. * readelf.c (decode_x86_feature_1): Support LAM_U48 and LAM_U57. * doc/binutils.texi: Update elfedit with lam_u48 and lam_u57 support. * testsuite/binutils-all/x86-64/lam-u48.d: New file. * testsuite/binutils-all/x86-64/lam-u48.s: Likewise. * testsuite/binutils-all/x86-64/lam-u57.d: Likewise. * testsuite/binutils-all/x86-64/lam-u57.s: Likewise. include/ * elf/common.h (GNU_PROPERTY_X86_FEATURE_1_LAM_U48): New. (GNU_PROPERTY_X86_FEATURE_1_LAM_U57): Likewise. ld/ * NEWS: Mention LAM_U48 and LAM_U57 support. * ld.texi: Document LAM_U48 and LAM_U57 support. * emulparams/cet.sh: Updated. * emulparams/elf_x86_64.sh: Source x86-64-lam.sh. * emulparams/x86-64-lam.sh: New file. * testsuite/ld-x86-64/property-x86-lam-u48-1a.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-1b.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-2.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-3a.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-3b.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-4.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-5.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48.s: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-1a.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-1b.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-2.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-3a.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-3b.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-4.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-5.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run LAM tests.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog25
-rw-r--r--ld/NEWS13
-rw-r--r--ld/emulparams/cet.sh14
-rw-r--r--ld/emulparams/elf_x86_64.sh1
-rw-r--r--ld/emulparams/x86-64-lam.sh69
-rw-r--r--ld/ld.texi44
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u48-1a.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u48-1b.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u48-2.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u48-3a.d12
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u48-3b.d12
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u48-4.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u48-5.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u48.s27
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u57-1a.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u57-1b.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u57-2.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u57-3a.d12
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u57-3b.d12
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u57-4.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u57-5.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-lam-u57.s27
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp14
23 files changed, 385 insertions, 7 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 05eaada..c34409c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,28 @@
+2020-12-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * NEWS: Mention LAM_U48 and LAM_U57 support.
+ * ld.texi: Document LAM_U48 and LAM_U57 support.
+ * emulparams/cet.sh: Updated.
+ * emulparams/elf_x86_64.sh: Source x86-64-lam.sh.
+ * emulparams/x86-64-lam.sh: New file.
+ * testsuite/ld-x86-64/property-x86-lam-u48-1a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u48-1b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u48-2.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u48-3a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u48-3b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u48-4.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u48-5.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u48.s: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u57-1a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u57-1b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u57-2.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u57-3a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u57-3b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u57-4.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u57-5.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-lam-u57.s: Likewise.
+ * testsuite/ld-x86-64/x86-64.exp: Run LAM tests.
+
2020-12-18 H.J. Lu <hongjiu.lu@intel.com>
PR ld/27082
diff --git a/ld/NEWS b/ld/NEWS
index 1c3f9c1..a5c0d7a 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -8,6 +8,19 @@
encountered. This option can be suppressed via the configure time
switch: --enable-error-handling-script=no.
+* Add -z lam-u48 to x86-64 ELF linker to generate LAM_U48 property.
+
+* Add -z lam-u57 to x86-64 ELF linker to enerate LAM_U57 property.
+
+* Add -z lam-u48-report=[none|warning|error] to report missing LAM_U48
+ property.
+
+* Add -z lam-u57-report=[none|warning|error] to report missing LAM_U57
+ property.
+
+* Add -z lam-report=[none|warning|error] to report missing LAM_U48 and
+ LAM_U57 properties.
+
* Add -z x86-64-{baseline|v[234]} to the x86 ELF linker to mark
x86-64-{baseline|v[234]} ISA level as needed.
diff --git a/ld/emulparams/cet.sh b/ld/emulparams/cet.sh
index f9a83ec..d9e81df 100644
--- a/ld/emulparams/cet.sh
+++ b/ld/emulparams/cet.sh
@@ -19,15 +19,15 @@ PARSE_AND_LIST_ARGS_CASE_Z_CET='
else if (strncmp (optarg, "cet-report=", 11) == 0)
{
if (strcmp (optarg + 11, "none") == 0)
- params.cet_report = cet_report_none;
+ params.cet_report = prop_report_none;
else if (strcmp (optarg + 11, "warning") == 0)
- params.cet_report = (cet_report_warning
- | cet_report_ibt
- | cet_report_shstk);
+ params.cet_report = (prop_report_warning
+ | prop_report_ibt
+ | prop_report_shstk);
else if (strcmp (optarg + 11, "error") == 0)
- params.cet_report = (cet_report_error
- | cet_report_ibt
- | cet_report_shstk);
+ params.cet_report = (prop_report_error
+ | prop_report_ibt
+ | prop_report_shstk);
else
einfo (_("%F%P: invalid option for -z cet-report=: %s\n"),
optarg + 11);
diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh
index 5996055..664ff18 100644
--- a/ld/emulparams/elf_x86_64.sh
+++ b/ld/emulparams/elf_x86_64.sh
@@ -5,6 +5,7 @@ source_sh ${srcdir}/emulparams/reloc_overflow.sh
source_sh ${srcdir}/emulparams/call_nop.sh
source_sh ${srcdir}/emulparams/cet.sh
source_sh ${srcdir}/emulparams/x86-64-level.sh
+source_sh ${srcdir}/emulparams/x86-64-lam.sh
source_sh ${srcdir}/emulparams/static.sh
SCRIPT_NAME=elf
ELFSIZE=64
diff --git a/ld/emulparams/x86-64-lam.sh b/ld/emulparams/x86-64-lam.sh
new file mode 100644
index 0000000..40ddb05
--- /dev/null
+++ b/ld/emulparams/x86-64-lam.sh
@@ -0,0 +1,69 @@
+PARSE_AND_LIST_OPTIONS_LAM='
+ fprintf (file, _("\
+ -z lam-u48 Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U48\n"));
+ fprintf (file, _("\
+ -z lam-u48-report=[none|warning|error] (default: none)\n\
+ Report missing LAM_U48 property\n"));
+ fprintf (file, _("\
+ -z lam-u57 Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U57\n"));
+ fprintf (file, _("\
+ -z lam-u57-report=[none|warning|error] (default: none)\n\
+ Report missing LAM_U57 property\n"));
+ fprintf (file, _("\
+ -z lam-report=[none|warning|error] (default: none)\n\
+ Report missing LAM_U48 and LAM_U57 properties\n"));
+'
+PARSE_AND_LIST_ARGS_CASE_Z_LAM='
+ else if (strcmp (optarg, "lam-u48") == 0)
+ params.lam_u48 = TRUE;
+ else if (strncmp (optarg, "lam-u48-report=", 15) == 0)
+ {
+ if (strcmp (optarg + 15, "none") == 0)
+ params.lam_u48_report = prop_report_none;
+ else if (strcmp (optarg + 15, "warning") == 0)
+ params.lam_u48_report = prop_report_warning;
+ else if (strcmp (optarg + 15, "error") == 0)
+ params.lam_u48_report = prop_report_error;
+ else
+ einfo (_("%F%P: invalid option for -z lam-u48-report=: %s\n"),
+ optarg + 15);
+ }
+ else if (strcmp (optarg, "lam-u57") == 0)
+ params.lam_u57 = TRUE;
+ else if (strncmp (optarg, "lam-u57-report=", 15) == 0)
+ {
+ if (strcmp (optarg + 15, "none") == 0)
+ params.lam_u57_report = prop_report_none;
+ else if (strcmp (optarg + 15, "warning") == 0)
+ params.lam_u57_report = prop_report_warning;
+ else if (strcmp (optarg + 15, "error") == 0)
+ params.lam_u57_report = prop_report_error;
+ else
+ einfo (_("%F%P: invalid option for -z lam-u57-report=: %s\n"),
+ optarg + 15);
+ }
+ else if (strncmp (optarg, "lam-report=", 11) == 0)
+ {
+ if (strcmp (optarg + 11, "none") == 0)
+ {
+ params.lam_u48_report = prop_report_none;
+ params.lam_u57_report = prop_report_none;
+ }
+ else if (strcmp (optarg + 11, "warning") == 0)
+ {
+ params.lam_u48_report = prop_report_warning;
+ params.lam_u57_report = prop_report_warning;
+ }
+ else if (strcmp (optarg + 11, "error") == 0)
+ {
+ params.lam_u48_report = prop_report_error;
+ params.lam_u57_report = prop_report_error;
+ }
+ else
+ einfo (_("%F%P: invalid option for -z lam-report=: %s\n"),
+ optarg + 11);
+ }
+'
+
+PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_LAM"
+PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_LAM"
diff --git a/ld/ld.texi b/ld/ld.texi
index 88b1687..98609a0 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -1316,6 +1316,50 @@ al which do not usually function correctly unless they are the sole instances
of themselves. This behaviour can be overridden by the @code{dlmopen} caller
and does not apply to certain loading mechanisms (such as audit libraries).
+@item lam-u48
+Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U48 in .note.gnu.property section
+to indicate compatibility with Intel LAM_U48. Supported for Linux/x86_64.
+
+@item lam-u57
+Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U57 in .note.gnu.property section
+to indicate compatibility with Intel LAM_U57. Supported for Linux/x86_64.
+
+@item lam-u48-report=none
+@itemx lam-u48-report=warning
+@itemx lam-u48-report=error
+Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U48
+property in input .note.gnu.property section.
+@option{lam-u48-report=none}, which is the default, will make the
+linker not report missing properties in input files.
+@option{lam-u48-report=warning} will make the linker issue a warning for
+missing properties in input files. @option{lam-u48-report=error} will
+make the linker issue an error for missing properties in input files.
+Supported for Linux/x86_64.
+
+@item lam-u57-report=none
+@itemx lam-u57-report=warning
+@itemx lam-u57-report=error
+Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U57
+property in input .note.gnu.property section.
+@option{lam-u57-report=none}, which is the default, will make the
+linker not report missing properties in input files.
+@option{lam-u57-report=warning} will make the linker issue a warning for
+missing properties in input files. @option{lam-u57-report=error} will
+make the linker issue an error for missing properties in input files.
+Supported for Linux/x86_64.
+
+@item lam-report=none
+@itemx lam-report=warning
+@itemx lam-report=error
+Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
+GNU_PROPERTY_X86_FEATURE_1_LAM_U57 properties in input .note.gnu.property
+section. @option{lam-report=none}, which is the default, will make the
+linker not report missing properties in input files.
+@option{lam-report=warning} will make the linker issue a warning for
+missing properties in input files. @option{lam-report=error} will make
+the linker issue an error for missing properties in input files.
+Supported for Linux/x86_64.
+
@item lazy
When generating an executable or shared library, mark it to tell the
dynamic linker to defer function call resolution to the point when
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u48-1a.d b/ld/testsuite/ld-x86-64/property-x86-lam-u48-1a.d
new file mode 100644
index 0000000..5c46f6e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u48-1a.d
@@ -0,0 +1,11 @@
+#source: property-x86-empty.s
+#source: property-x86-lam-u48.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u48-1b.d b/ld/testsuite/ld-x86-64/property-x86-lam-u48-1b.d
new file mode 100644
index 0000000..ed083fb
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u48-1b.d
@@ -0,0 +1,11 @@
+#source: property-x86-lam-u48.s
+#source: property-x86-empty.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u48-2.d b/ld/testsuite/ld-x86-64/property-x86-lam-u48-2.d
new file mode 100644
index 0000000..7e9c50e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u48-2.d
@@ -0,0 +1,11 @@
+#source: property-x86-lam-u48.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: LAM_U48
+ x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u48-3a.d b/ld/testsuite/ld-x86-64/property-x86-lam-u48-3a.d
new file mode 100644
index 0000000..6e9194a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u48-3a.d
@@ -0,0 +1,12 @@
+#source: property-x86-3.s
+#source: property-x86-lam-u48.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, <unknown: 10>, <unknown: 20>
+ x86 feature used: x86
+ x86 ISA used: x86-64-v2, x86-64-v4, <unknown: 20>, <unknown: 80>
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u48-3b.d b/ld/testsuite/ld-x86-64/property-x86-lam-u48-3b.d
new file mode 100644
index 0000000..1541751
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u48-3b.d
@@ -0,0 +1,12 @@
+#source: property-x86-lam-u48.s
+#source: property-x86-3.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, <unknown: 10>, <unknown: 20>
+ x86 feature used: x86
+ x86 ISA used: x86-64-v2, x86-64-v4, <unknown: 20>, <unknown: 80>
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u48-4.d b/ld/testsuite/ld-x86-64/property-x86-lam-u48-4.d
new file mode 100644
index 0000000..82cd7e2
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u48-4.d
@@ -0,0 +1,11 @@
+#source: property-x86-empty.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64 -z lam-u48
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: LAM_U48
+ x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u48-5.d b/ld/testsuite/ld-x86-64/property-x86-lam-u48-5.d
new file mode 100644
index 0000000..755d0d5
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u48-5.d
@@ -0,0 +1,11 @@
+#source: start.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64 -z lam-u48
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: LAM_U48
+ x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u48.s b/ld/testsuite/ld-x86-64/property-x86-lam-u48.s
new file mode 100644
index 0000000..52db75f
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u48.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x4
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u57-1a.d b/ld/testsuite/ld-x86-64/property-x86-lam-u57-1a.d
new file mode 100644
index 0000000..e1c237c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u57-1a.d
@@ -0,0 +1,11 @@
+#source: property-x86-empty.s
+#source: property-x86-lam-u57.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u57-1b.d b/ld/testsuite/ld-x86-64/property-x86-lam-u57-1b.d
new file mode 100644
index 0000000..26eca4a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u57-1b.d
@@ -0,0 +1,11 @@
+#source: property-x86-lam-u57.s
+#source: property-x86-empty.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u57-2.d b/ld/testsuite/ld-x86-64/property-x86-lam-u57-2.d
new file mode 100644
index 0000000..1f1c86a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u57-2.d
@@ -0,0 +1,11 @@
+#source: property-x86-lam-u57.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: LAM_U57
+ x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u57-3a.d b/ld/testsuite/ld-x86-64/property-x86-lam-u57-3a.d
new file mode 100644
index 0000000..fb6289a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u57-3a.d
@@ -0,0 +1,12 @@
+#source: property-x86-3.s
+#source: property-x86-lam-u57.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, <unknown: 10>, <unknown: 20>
+ x86 feature used: x86
+ x86 ISA used: x86-64-v2, x86-64-v4, <unknown: 20>, <unknown: 80>
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u57-3b.d b/ld/testsuite/ld-x86-64/property-x86-lam-u57-3b.d
new file mode 100644
index 0000000..f33818d
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u57-3b.d
@@ -0,0 +1,12 @@
+#source: property-x86-lam-u57.s
+#source: property-x86-3.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, <unknown: 10>, <unknown: 20>
+ x86 feature used: x86
+ x86 ISA used: x86-64-v2, x86-64-v4, <unknown: 20>, <unknown: 80>
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u57-4.d b/ld/testsuite/ld-x86-64/property-x86-lam-u57-4.d
new file mode 100644
index 0000000..9f51f89
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u57-4.d
@@ -0,0 +1,11 @@
+#source: property-x86-empty.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64 -z lam-u57
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: LAM_U57
+ x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u57-5.d b/ld/testsuite/ld-x86-64/property-x86-lam-u57-5.d
new file mode 100644
index 0000000..d0b69e6
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u57-5.d
@@ -0,0 +1,11 @@
+#source: start.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#ld: -r -melf_x86_64 -z lam-u57
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: LAM_U57
+ x86 feature used: x86
+ x86 ISA used:
diff --git a/ld/testsuite/ld-x86-64/property-x86-lam-u57.s b/ld/testsuite/ld-x86-64/property-x86-lam-u57.s
new file mode 100644
index 0000000..d53098d
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-lam-u57.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x8
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 41d385b..a548a32 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -373,6 +373,20 @@ run_dump_test "property-x86-cet5b"
run_dump_test "property-x86-cet5b-x32"
run_dump_test "property-x86-cet6"
run_dump_test "property-x86-cet6-x32"
+run_dump_test "property-x86-lam-u48-1a"
+run_dump_test "property-x86-lam-u48-1b"
+run_dump_test "property-x86-lam-u48-2"
+run_dump_test "property-x86-lam-u48-3a"
+run_dump_test "property-x86-lam-u48-3b"
+run_dump_test "property-x86-lam-u48-4"
+run_dump_test "property-x86-lam-u48-5"
+run_dump_test "property-x86-lam-u57-1a"
+run_dump_test "property-x86-lam-u57-1b"
+run_dump_test "property-x86-lam-u57-2"
+run_dump_test "property-x86-lam-u57-3a"
+run_dump_test "property-x86-lam-u57-3b"
+run_dump_test "property-x86-lam-u57-4"
+run_dump_test "property-x86-lam-u57-5"
run_dump_test "pr21884"
run_dump_test "pr22071"
run_dump_test "pr22115-1a"