]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86-64: Add Intel LAM property support
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 23 Dec 2020 21:00:39 +0000 (13:00 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 23 Dec 2020 21:00:55 +0000 (13:00 -0800)
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.

37 files changed:
bfd/ChangeLog
bfd/elf-linker-x86.h
bfd/elfxx-x86.c
binutils/ChangeLog
binutils/NEWS
binutils/doc/binutils.texi
binutils/elfedit.c
binutils/readelf.c
binutils/testsuite/binutils-all/x86-64/lam-u48.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/lam-u48.s [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/lam-u57.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/lam-u57.s [new file with mode: 0644]
include/ChangeLog
include/elf/common.h
ld/ChangeLog
ld/NEWS
ld/emulparams/cet.sh
ld/emulparams/elf_x86_64.sh
ld/emulparams/x86-64-lam.sh [new file with mode: 0644]
ld/ld.texi
ld/testsuite/ld-x86-64/property-x86-lam-u48-1a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u48-1b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u48-2.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u48-3a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u48-3b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u48-4.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u48-5.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u48.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u57-1a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u57-1b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u57-2.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u57-3a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u57-3b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u57-4.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u57-5.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-lam-u57.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp

index 582add86d20556dc31a13020c4e9047aad84b30b..0cb006d694438a92c42de4a236635630ba3fcf58 100644 (file)
@@ -1,3 +1,15 @@
+2020-12-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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.
+
 2020-12-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/27091
index 77e81960ab7fda2a82383a14e59f5925e5bfa4a6..c0f8fab8bb75cb48af105a77663a6c7a232262ff 100644 (file)
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
-/* Missing IBT and SHSTK property report control.  */
-enum elf_x86_cet_report
+/* Missing IBT, SHSTK and LAM property report control.  */
+enum elf_x86_prop_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.  */
+  prop_report_none     = 0,        /* Do nothing.  */
+  prop_report_warning  = 1 << 0,   /* Issue a warning.  */
+  prop_report_error    = 1 << 1,   /* Issue an error.  */
+  prop_report_ibt      = 1 << 2,   /* Report missing IBT property.  */
+  prop_report_shstk    = 1 << 3    /* Report missing SHSTK property.  */
 };
 
 /* Used to pass x86-specific linker options from ld to bfd.  */
@@ -43,6 +43,12 @@ struct elf_linker_x86_params
   /* TRUE if GNU_PROPERTY_X86_FEATURE_1_SHSTK should be generated.  */
   unsigned int shstk: 1;
 
+  /* TRUE if GNU_PROPERTY_X86_FEATURE_1_LAM_U48 should be generated.  */
+  unsigned int lam_u48: 1;
+
+  /* TRUE if GNU_PROPERTY_X86_FEATURE_1_LAM_U57 should be generated.  */
+  unsigned int lam_u57: 1;
+
   /* TRUE if we shouldn't check relocation overflow.  */
   unsigned int no_reloc_overflow_check: 1;
 
@@ -59,7 +65,13 @@ struct elf_linker_x86_params
   unsigned int isa_level;
 
   /* Report missing IBT and SHSTK properties.  */
-  enum elf_x86_cet_report cet_report;
+  enum elf_x86_prop_report cet_report;
+
+  /* Report missing LAM_U48 property.  */
+  enum elf_x86_prop_report lam_u48_report;
+
+  /* Report missing LAM_U57 property.  */
+  enum elf_x86_prop_report lam_u57_report;
 
   /* The 1-byte NOP for x86 call instruction.  */
   char call_nop_byte;
index 8246fe5bd1b3fd12c1c57764c7d7cfc8a6c4087e..6c652d54ab0d8abc1bb036fdf6ac2add3cc0ebf9 100644 (file)
@@ -2545,15 +2545,25 @@ _bfd_x86_elf_link_setup_gnu_properties
   if (htab->params->ibt)
     {
       features = GNU_PROPERTY_X86_FEATURE_1_IBT;
-      htab->params->cet_report &= ~cet_report_ibt;
+      htab->params->cet_report &= ~prop_report_ibt;
     }
   if (htab->params->shstk)
     {
       features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
-      htab->params->cet_report &= ~cet_report_shstk;
+      htab->params->cet_report &= ~prop_report_shstk;
+    }
+  if (!(htab->params->cet_report & (prop_report_ibt | prop_report_shstk)))
+    htab->params->cet_report = prop_report_none;
+  if (htab->params->lam_u48)
+    {
+      features |= GNU_PROPERTY_X86_FEATURE_1_LAM_U48;
+      htab->params->lam_u48_report = prop_report_none;
+    }
+  if (htab->params->lam_u57)
+    {
+      features |= GNU_PROPERTY_X86_FEATURE_1_LAM_U57;
+      htab->params->lam_u57_report = prop_report_none;
     }
-  if (!(htab->params->cet_report & (cet_report_ibt | cet_report_shstk)))
-    htab->params->cet_report = cet_report_none;
 
   switch (htab->params->isa_level)
     {
@@ -2581,8 +2591,10 @@ _bfd_x86_elf_link_setup_gnu_properties
       prop = NULL;
       if (features)
        {
-         /* If features is set, add GNU_PROPERTY_X86_FEATURE_1_IBT and
-            GNU_PROPERTY_X86_FEATURE_1_SHSTK.  */
+         /* If features is set, add GNU_PROPERTY_X86_FEATURE_1_IBT,
+            GNU_PROPERTY_X86_FEATURE_1_SHSTK,
+            GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
+            GNU_PROPERTY_X86_FEATURE_1_LAM_U57.  */
          prop = _bfd_elf_get_property (ebfd,
                                        GNU_PROPERTY_X86_FEATURE_1_AND,
                                        4);
@@ -2625,22 +2637,49 @@ _bfd_x86_elf_link_setup_gnu_properties
        }
     }
 
-  if (htab->params->cet_report)
+  if (htab->params->cet_report
+      || htab->params->lam_u48_report
+      || htab->params->lam_u57_report)
     {
-      /* Report missing IBT and SHSTK properties.  */
+      /* Report missing IBT, SHSTK and LAM properties.  */
       bfd *abfd;
-      const char *msg;
+      const char *warning_msg = _("%P: %pB: warning: missing %s\n");
+      const char *error_msg = _("%X%P: %pB: error: missing %s\n");
+      const char *cet_msg = NULL;
+      const char *lam_u48_msg = NULL;
+      const char *lam_u57_msg = NULL;
+      const char *missing;
       elf_property_list *p;
       bfd_boolean missing_ibt, missing_shstk;
+      bfd_boolean missing_lam_u48, missing_lam_u57;
       bfd_boolean check_ibt
-       = !!(htab->params->cet_report & cet_report_ibt);
+       = (htab->params->cet_report
+          && (htab->params->cet_report & prop_report_ibt));
       bfd_boolean check_shstk
-       = !!(htab->params->cet_report & cet_report_shstk);
+       = (htab->params->cet_report
+          && (htab->params->cet_report & prop_report_shstk));
 
-      if ((htab->params->cet_report & cet_report_warning))
-       msg = _("%P: %pB: warning: missing %s\n");
-      else
-       msg = _("%X%P: %pB: error: missing %s\n");
+      if (htab->params->cet_report)
+       {
+         if ((htab->params->cet_report & prop_report_warning))
+           cet_msg = warning_msg;
+         else
+           cet_msg = error_msg;
+       }
+      if (htab->params->lam_u48_report)
+       {
+         if ((htab->params->lam_u48_report & prop_report_warning))
+           lam_u48_msg = warning_msg;
+         else
+           lam_u48_msg = error_msg;
+       }
+      if (htab->params->lam_u57_report)
+       {
+         if ((htab->params->lam_u57_report & prop_report_warning))
+           lam_u57_msg = warning_msg;
+         else
+           lam_u57_msg = error_msg;
+       }
 
       for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
        if (!(abfd->flags & (DYNAMIC | BFD_PLUGIN | BFD_LINKER_CREATED))
@@ -2652,23 +2691,38 @@ _bfd_x86_elf_link_setup_gnu_properties
 
            missing_ibt = check_ibt;
            missing_shstk = check_shstk;
+           missing_lam_u48 = !!lam_u48_msg;
+           missing_lam_u57 = !!lam_u57_msg;
            if (p)
              {
                missing_ibt &= !(p->property.u.number
                                 & GNU_PROPERTY_X86_FEATURE_1_IBT);
                missing_shstk &= !(p->property.u.number
                                   & GNU_PROPERTY_X86_FEATURE_1_SHSTK);
+               missing_lam_u48 &= !(p->property.u.number
+                                    & GNU_PROPERTY_X86_FEATURE_1_LAM_U48);
+               missing_lam_u57 &= !(p->property.u.number
+                                    & GNU_PROPERTY_X86_FEATURE_1_LAM_U57);
              }
            if (missing_ibt || missing_shstk)
              {
-               const char *missing;
                if (missing_ibt && missing_shstk)
                  missing = _("IBT and SHSTK properties");
                else if (missing_ibt)
                  missing = _("IBT property");
                else
                  missing = _("SHSTK property");
-               info->callbacks->einfo (msg, abfd, missing);
+               info->callbacks->einfo (cet_msg, abfd, missing);
+             }
+           if (missing_lam_u48)
+             {
+               missing = _("LAM_U48 property");
+               info->callbacks->einfo (lam_u48_msg, abfd, missing);
+             }
+           if (missing_lam_u57)
+             {
+               missing = _("LAM_U57 property");
+               info->callbacks->einfo (lam_u57_msg, abfd, missing);
              }
          }
     }
@@ -3008,8 +3062,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 
 void
 _bfd_x86_elf_link_fixup_gnu_properties
-  (struct bfd_link_info *info ATTRIBUTE_UNUSED,
-   elf_property_list **listp)
+  (struct bfd_link_info *info, elf_property_list **listp)
 {
   elf_property_list *p;
 
@@ -3037,6 +3090,12 @@ _bfd_x86_elf_link_fixup_gnu_properties
              continue;
            }
 
+         /* Keep LAM features only for 64-bit output.  */
+         if (type == GNU_PROPERTY_X86_FEATURE_1_AND
+             && !ABI_64_P (info->output_bfd))
+           p->property.u.number &= ~(GNU_PROPERTY_X86_FEATURE_1_LAM_U48
+                                     | GNU_PROPERTY_X86_FEATURE_1_LAM_U57);
+
          listp = &p->next;
        }
       else if (type > GNU_PROPERTY_HIPROC)
index 885b47034847d07ac0729059d76d634ee84fc86d..298c28c7e678524d3870e688d4eadda5eceb54dc 100644 (file)
@@ -1,3 +1,16 @@
+2020-12-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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.
+
 2020-12-15  Vivek Das Mohapatra  <vivek@collabora.com>
 
        * readelf.c (get_dynamic_type): Handle DT_GNU_FLAGS_1.
index a5a31959ffecaa513033819a73cc02c96c3c6937..20b73f503dd4502f26ea3c4166ed83cee7e32464 100644 (file)
@@ -1,5 +1,7 @@
 -*- text -*-
 
+* Update elfedit and readelf with LAM_U48 and LAM_U57 support.
+
 * Nm has a new command line option: --ifunc-chars=CHARS.  This specifies a
   string of one or two characters.  The first character is used as the type
   character when displaying global ifunc symbols.  The second character, if
index 671694f8111e68f394e40a2d9a81c368c85fb089..0ed3548d95cd990accc9f832163e32adcbb06b59 100644 (file)
@@ -5117,7 +5117,8 @@ supported ELF OSABI are the same as @option{--input-osabi}.
 @item --enable-x86-feature=@var{feature}
 Set the @var{feature} bit in program property in @var{exec} or @var{dyn}
 ELF files with machine types of @var{i386} or @var{x86-64}.  The
-supported features are, @var{ibt} and @var{shstk}.
+supported features are, @var{ibt}, @var{shstk}, @var{lam_u48} and
+@var{lam_u57}.
 
 @item --disable-x86-feature=@var{feature}
 Clear the @var{feature} bit in program property in @var{exec} or
index 55474ffbbcebc3e101708857760a6d34a07622fb..dc2f722d386b63f6bbbdfe82a49ce39d030dc1f5 100644 (file)
@@ -260,6 +260,10 @@ elf_x86_feature (const char *feature, int enable)
     x86_feature = GNU_PROPERTY_X86_FEATURE_1_IBT;
   else if (strcasecmp (feature, "shstk") == 0)
     x86_feature = GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+  else if (strcasecmp (feature, "lam_u48") == 0)
+    x86_feature = GNU_PROPERTY_X86_FEATURE_1_LAM_U48;
+  else if (strcasecmp (feature, "lam_u57") == 0)
+    x86_feature = GNU_PROPERTY_X86_FEATURE_1_LAM_U57;
   else
     {
       error (_("Unknown x86 feature: %s\n"), feature);
@@ -920,9 +924,9 @@ usage (FILE *stream, int exit_status)
           osabi, osabi);
 #ifdef HAVE_MMAP
   fprintf (stream, _("\
-  --enable-x86-feature [ibt|shstk]\n\
+  --enable-x86-feature [ibt|shstk|lam_u48|lam_u57]\n\
                               Enable x86 feature\n\
-  --disable-x86-feature [ibt|shstk]\n\
+  --disable-x86-feature [ibt|shstk|lam_u48|lam_u57]\n\
                               Disable x86 feature\n"));
 #endif
   fprintf (stream, _("\
index 22354ba951b3a15593fe319f9002710ab50c9ef8..46fd87a974a5e9e84fda5ec8a8a72e9ea681e609 100644 (file)
@@ -18748,6 +18748,12 @@ decode_x86_feature_1 (unsigned int bitmask)
        case GNU_PROPERTY_X86_FEATURE_1_SHSTK:
          printf ("SHSTK");
          break;
+       case GNU_PROPERTY_X86_FEATURE_1_LAM_U48:
+         printf ("LAM_U48");
+         break;
+       case GNU_PROPERTY_X86_FEATURE_1_LAM_U57:
+         printf ("LAM_U57");
+         break;
        default:
          printf (_("<unknown: %x>"), bit);
          break;
diff --git a/binutils/testsuite/binutils-all/x86-64/lam-u48.d b/binutils/testsuite/binutils-all/x86-64/lam-u48.d
new file mode 100644 (file)
index 0000000..92d7d81
--- /dev/null
@@ -0,0 +1,12 @@
+#PROG: objcopy
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: x86 feature: LAM_U48
+  GNU                  0x00000020      NT_GNU_PROPERTY_TYPE_0
+      Properties: x86 ISA used: 
+       x86 feature used: x86
diff --git a/binutils/testsuite/binutils-all/x86-64/lam-u48.s b/binutils/testsuite/binutils-all/x86-64/lam-u48.s
new file mode 100644 (file)
index 0000000..52db75f
--- /dev/null
@@ -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/binutils/testsuite/binutils-all/x86-64/lam-u57.d b/binutils/testsuite/binutils-all/x86-64/lam-u57.d
new file mode 100644 (file)
index 0000000..c922075
--- /dev/null
@@ -0,0 +1,12 @@
+#PROG: objcopy
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: x86 feature: LAM_U57
+  GNU                  0x00000020      NT_GNU_PROPERTY_TYPE_0
+      Properties: x86 ISA used: 
+       x86 feature used: x86
diff --git a/binutils/testsuite/binutils-all/x86-64/lam-u57.s b/binutils/testsuite/binutils-all/x86-64/lam-u57.s
new file mode 100644 (file)
index 0000000..d53098d
--- /dev/null
@@ -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:
index 933e7dab45dea81617fd5dd253cc297224b7f6c9..976b36105e3d06009ea0bd2aea9418388899c9ff 100644 (file)
@@ -1,3 +1,8 @@
+2020-12-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf/common.h (GNU_PROPERTY_X86_FEATURE_1_LAM_U48): New.
+       (GNU_PROPERTY_X86_FEATURE_1_LAM_U57): Likewise.
+
 2020-12-18  Alan Modra  <amodra@gmail.com>
 
        * xtensa-isa-internal.h (xtisa_errno, xtisa_error_msg): Delete.
index 4d3718a2f012e2f638bf839e690a0ca6b392e7e2..39e1a3f1676c4cd7df55b8a66aa0aa4f81b5f1ac 100644 (file)
 
 #define GNU_PROPERTY_X86_FEATURE_1_IBT         (1U << 0)
 #define GNU_PROPERTY_X86_FEATURE_1_SHSTK       (1U << 1)
+#define GNU_PROPERTY_X86_FEATURE_1_LAM_U48     (1U << 2)
+#define GNU_PROPERTY_X86_FEATURE_1_LAM_U57     (1U << 3)
 
 #define GNU_PROPERTY_X86_FEATURE_2_X86         (1U << 0)
 #define GNU_PROPERTY_X86_FEATURE_2_X87         (1U << 1)
index 05eaadad3b4128a4353e6eca491b2cea9fe2b895..c34409c575ff46428b282db9ac9740f1da06a346 100644 (file)
@@ -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 1c3f9c156e4640497e184c14a1eb6f07bd7e7619..a5c0d7a2f6557d459d3f87585b6bf0ca83daca3e 100644 (file)
--- 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.
 
index f9a83ec099be20fc297231a06cbd5a8f0009b764..d9e81df6954085cd9c2c23bd8d694d2e5ce00e00 100644 (file)
@@ -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);
index 5996055e9ff9f188d505bf208bd45cac0f6cf2c5..664ff189c0480cfd84e637fec0e656c75e223a90 100644 (file)
@@ -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 (file)
index 0000000..40ddb05
--- /dev/null
@@ -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"
index 88b1687f1bb34f9843c9e8e671a56b89e16cacce..98609a0af223cb41ef88739becb0251efa90e8f8 100644 (file)
@@ -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 (file)
index 0000000..5c46f6e
--- /dev/null
@@ -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 (file)
index 0000000..ed083fb
--- /dev/null
@@ -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 (file)
index 0000000..7e9c50e
--- /dev/null
@@ -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 (file)
index 0000000..6e9194a
--- /dev/null
@@ -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 (file)
index 0000000..1541751
--- /dev/null
@@ -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 (file)
index 0000000..82cd7e2
--- /dev/null
@@ -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 (file)
index 0000000..755d0d5
--- /dev/null
@@ -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 (file)
index 0000000..52db75f
--- /dev/null
@@ -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 (file)
index 0000000..e1c237c
--- /dev/null
@@ -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 (file)
index 0000000..26eca4a
--- /dev/null
@@ -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 (file)
index 0000000..1f1c86a
--- /dev/null
@@ -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 (file)
index 0000000..fb6289a
--- /dev/null
@@ -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 (file)
index 0000000..f33818d
--- /dev/null
@@ -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 (file)
index 0000000..9f51f89
--- /dev/null
@@ -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 (file)
index 0000000..d0b69e6
--- /dev/null
@@ -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 (file)
index 0000000..d53098d
--- /dev/null
@@ -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:
index 41d385bf058c083ed29aa1193650c9ed4edfab28..a548a325a3c10620a91319be72da98fa009ca98a 100644 (file)
@@ -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"