public inbox for gnu-gabi@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: GNU gABI gnu-gabi <gnu-gabi@sourceware.org>,
	GCC Development <gcc@gcc.gnu.org>,
	 Binutils <binutils@sourceware.org>,
	GNU C Library <libc-alpha@sourceware.org>,
	 llvm-dev@lists.llvm.org
Subject: Re: RFC: Add GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX
Date: Thu, 21 Jan 2021 07:02:03 -0800	[thread overview]
Message-ID: <CAMe9rOoG6NtMFp=jdj9yKPqoWbQ0932OodVRVcVsCUxhi8dLnQ@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOq1hJiTaen1bH7SpWCB0hz0T39g5YTiOD-sk9jzwZrt1g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]

On Wed, Jan 13, 2021 at 9:06 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> 1. GNU_PROPERTY_UINT32_AND_LO..GNU_PROPERTY_UINT32_AND_HI
>
>  #define GNU_PROPERTY_UINT32_AND_LO 0xb0000000
>  #define GNU_PROPERTY_UINT32_AND_HI 0xb0007fff
>
> A bit in the output pr_data field is set only if it is set in all
> relocatable input pr_data fields.  If all bits in the the output
> pr_data field are zero, this property should be removed from output.
>
> If the bit is 1, all input relocatables have the feature.  If the
> bit is 0 or the property is missing, the info is unknown.
>
> 2. GNU_PROPERTY_UINT32_OR_LO..GNU_PROPERTY_UINT32_OR_HI
>
>  #define GNU_PROPERTY_UINT32_OR_LO 0xb0008000
>  #define GNU_PROPERTY_UINT32_OR_HI 0xb000ffff
>
> A bit in the output pr_data field is set if it is set in any
> relocatable input pr_data fields. If all bits in the the output
> pr_data field are zero, this property should be removed from output.
>
> If the bit is 1, some input relocatables have the feature.  If the
> bit is 0 or the property is missing, the info is unknown.
>
> The PDF is at
>
> https://gitlab.com/x86-psABIs/Linux-ABI/-/wikis/uploads/0690db0a3b7e5d8a44e0271a4be54aa7/linux-gABI-and-or-2021-01-13.pdf
>
> --
> H.J.

Here is the binutils patch to implement it.

-- 
H.J.

[-- Attachment #2: 0001-elf-Add-GNU_PROPERTY_UINT32_AND_XXX-GNU_PROPERTY_UIN.patch --]
[-- Type: text/x-patch, Size: 17740 bytes --]

From 347b7c47ac6c2149b7e6bfb318bd85a030ce2096 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 16 Jan 2021 05:35:46 -0800
Subject: [PATCH] elf: Add
 GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX

Implement GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX:

https://sourceware.org/pipermail/gnu-gabi/2021q1/000467.html

1. GNU_PROPERTY_UINT32_AND_LO..GNU_PROPERTY_UINT32_AND_HI

 #define GNU_PROPERTY_UINT32_AND_LO 0xb0000000
 #define GNU_PROPERTY_UINT32_AND_HI 0xb0007fff

A bit in the output pr_data field is set only if it is set in all
relocatable input pr_data fields.  If all bits in the the output
pr_data field are zero, this property should be removed from output.

If the bit is 1, all input relocatables have the feature.  If the
bit is 0 or the property is missing, the info is unknown.

2. GNU_PROPERTY_UINT32_OR_LO..GNU_PROPERTY_UINT32_OR_HI

 #define GNU_PROPERTY_UINT32_OR_LO 0xb0008000
 #define GNU_PROPERTY_UINT32_OR_HI 0xb000ffff

A bit in the output pr_data field is set if it is set in any
relocatable input pr_data fields. If all bits in the the output
pr_data field are zero, this property should be removed from output.

If the bit is 1, some input relocatables have the feature.  If the
bit is 0 or the property is missing, the info is unknown.

bfd/

	* elf-properties.c (_bfd_elf_parse_gnu_properties): Handle
	GNU_PROPERTY_UINT32_AND_LO, GNU_PROPERTY_UINT32_AND_HI,
	GNU_PROPERTY_UINT32_OR_LO and GNU_PROPERTY_UINT32_OR_HI.
	(elf_merge_gnu_properties): Likewise.

binutils/

	* readelf.c (print_gnu_property_note): Handle
	GNU_PROPERTY_UINT32_AND_LO, GNU_PROPERTY_UINT32_AND_HI,
	GNU_PROPERTY_UINT32_OR_LO and GNU_PROPERTY_UINT32_OR_HI.

include/

	* elf/common.h (GNU_PROPERTY_UINT32_AND_LO): New.
	(GNU_PROPERTY_UINT32_AND_HI): Likewise.
	(GNU_PROPERTY_UINT32_OR_LO): Likewise.
	(GNU_PROPERTY_UINT32_OR_HI): Likewise.

ld/

	* testsuite/ld-elf/property-and-1.d: New file.
	* testsuite/ld-elf/property-and-1.s: Likewise.
	* testsuite/ld-elf/property-and-2.d: Likewise.
	* testsuite/ld-elf/property-and-2.s: Likewise.
	* testsuite/ld-elf/property-and-3.d: Likewise.
	* testsuite/ld-elf/property-and-3.s: Likewise.
	* testsuite/ld-elf/property-and-4.d: Likewise.
	* testsuite/ld-elf/property-and-empty.s: Likewise.
	* testsuite/ld-elf/property-or-1.d: Likewise.
	* testsuite/ld-elf/property-or-1.s: Likewise.
	* testsuite/ld-elf/property-or-2.d: Likewise.
	* testsuite/ld-elf/property-or-2.s: Likewise.
	* testsuite/ld-elf/property-or-3.d: Likewise.
	* testsuite/ld-elf/property-or-3.s: Likewise.
	* testsuite/ld-elf/property-or-4.d: Likewise.
	* testsuite/ld-elf/property-or-empty.s: Likewise.
---
 bfd/elf-properties.c                     | 90 ++++++++++++++++++++++++
 binutils/readelf.c                       | 15 ++++
 include/elf/common.h                     | 10 +++
 ld/testsuite/ld-elf/property-and-1.d     |  7 ++
 ld/testsuite/ld-elf/property-and-1.s     | 15 ++++
 ld/testsuite/ld-elf/property-and-2.d     |  8 +++
 ld/testsuite/ld-elf/property-and-2.s     | 15 ++++
 ld/testsuite/ld-elf/property-and-3.d     |  8 +++
 ld/testsuite/ld-elf/property-and-3.s     | 15 ++++
 ld/testsuite/ld-elf/property-and-4.d     | 12 ++++
 ld/testsuite/ld-elf/property-and-empty.s | 15 ++++
 ld/testsuite/ld-elf/property-or-1.d      | 11 +++
 ld/testsuite/ld-elf/property-or-1.s      | 15 ++++
 ld/testsuite/ld-elf/property-or-2.d      | 12 ++++
 ld/testsuite/ld-elf/property-or-2.s      | 15 ++++
 ld/testsuite/ld-elf/property-or-3.d      | 12 ++++
 ld/testsuite/ld-elf/property-or-3.s      | 15 ++++
 ld/testsuite/ld-elf/property-or-4.d      | 12 ++++
 ld/testsuite/ld-elf/property-or-empty.s  | 15 ++++
 19 files changed, 317 insertions(+)
 create mode 100644 ld/testsuite/ld-elf/property-and-1.d
 create mode 100644 ld/testsuite/ld-elf/property-and-1.s
 create mode 100644 ld/testsuite/ld-elf/property-and-2.d
 create mode 100644 ld/testsuite/ld-elf/property-and-2.s
 create mode 100644 ld/testsuite/ld-elf/property-and-3.d
 create mode 100644 ld/testsuite/ld-elf/property-and-3.s
 create mode 100644 ld/testsuite/ld-elf/property-and-4.d
 create mode 100644 ld/testsuite/ld-elf/property-and-empty.s
 create mode 100644 ld/testsuite/ld-elf/property-or-1.d
 create mode 100644 ld/testsuite/ld-elf/property-or-1.s
 create mode 100644 ld/testsuite/ld-elf/property-or-2.d
 create mode 100644 ld/testsuite/ld-elf/property-or-2.s
 create mode 100644 ld/testsuite/ld-elf/property-or-3.d
 create mode 100644 ld/testsuite/ld-elf/property-or-3.s
 create mode 100644 ld/testsuite/ld-elf/property-or-4.d
 create mode 100644 ld/testsuite/ld-elf/property-or-empty.s

diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index 491fa1aa8c6..6db618c91a0 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -178,6 +178,25 @@ _bfd_elf_parse_gnu_properties (bfd *abfd, Elf_Internal_Note *note)
 	      goto next;
 
 	    default:
+	      if ((type >= GNU_PROPERTY_UINT32_AND_LO
+		   && type <= GNU_PROPERTY_UINT32_AND_HI)
+		  || (type >= GNU_PROPERTY_UINT32_OR_LO
+		      && type <= GNU_PROPERTY_UINT32_OR_HI))
+		{
+		  if (datasz != 4)
+		    {
+		      _bfd_error_handler
+			(_("error: %pB: <corrupt property (0x%x) size: 0x%x>"),
+			 abfd, type, datasz);
+		      /* Clear all properties.  */
+		      elf_properties (abfd) = NULL;
+		      return FALSE;
+		    }
+		  prop = _bfd_elf_get_property (abfd, type, datasz);
+		  prop->u.number |= bfd_h_get_32 (abfd, ptr);
+		  prop->pr_kind = property_number;
+		  goto next;
+		}
 	      break;
 	    }
 	}
@@ -203,6 +222,8 @@ elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd, bfd *bbfd,
 {
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
   unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
+  unsigned int number;
+  bfd_boolean updated;
 
   if (bed->merge_gnu_properties != NULL
       && pr_type >= GNU_PROPERTY_LOPROC
@@ -229,6 +250,75 @@ elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd, bfd *bbfd,
       return aprop == NULL;
 
     default:
+      updated = FALSE;
+      if (pr_type >= GNU_PROPERTY_UINT32_OR_LO
+	  && pr_type <= GNU_PROPERTY_UINT32_OR_HI)
+	{
+	  if (aprop != NULL && bprop != NULL)
+	    {
+	      number = aprop->u.number;
+	      aprop->u.number = number | bprop->u.number;
+	      /* Remove the property if all bits are empty.  */
+	      if (aprop->u.number == 0)
+		{
+		  aprop->pr_kind = property_remove;
+		  updated = TRUE;
+		}
+	      else
+		updated = number != (unsigned int) aprop->u.number;
+	    }
+	  else
+	    {
+	      /* Only one of APROP and BPROP can be NULL.  */
+	      if (aprop != NULL)
+		{
+		  if (aprop->u.number == 0)
+		    {
+		      /* Remove APROP if all bits are empty.  */
+		      aprop->pr_kind = property_remove;
+		      updated = TRUE;
+		    }
+		}
+	      else
+		{
+		  /* Return TRUE if APROP is NULL and all bits of BPROP
+		     aren't empty to indicate that BPROP should be added
+		     to ABFD.  */
+		  updated = bprop->u.number != 0;
+		}
+	    }
+	  return updated;
+	}
+      else if (pr_type >= GNU_PROPERTY_UINT32_AND_LO
+	       && pr_type <= GNU_PROPERTY_UINT32_AND_HI)
+	{
+	  /* Only one of APROP and BPROP can be NULL:
+	     1. APROP & BPROP when both APROP and BPROP aren't NULL.
+	     2. If APROP is NULL, remove x86 feature.
+	     3. Otherwise, do nothing.
+	     */
+	  if (aprop != NULL && bprop != NULL)
+	    {
+	      number = aprop->u.number;
+	      aprop->u.number = number & bprop->u.number;
+	      updated = number != (unsigned int) aprop->u.number;
+	      /* Remove the property if all feature bits are cleared.  */
+	      if (aprop->u.number == 0)
+		aprop->pr_kind = property_remove;
+	    }
+	  else
+	    {
+	      /* There should be no AND properties since some input
+	         doesn't have them.   */
+	      if (aprop != NULL)
+		{
+		  aprop->pr_kind = property_remove;
+		  updated = TRUE;
+		}
+	    }
+	  return updated;
+	}
+
       /* Never should happen.  */
       abort ();
     }
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 5df51086226..be87767072a 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -19048,6 +19048,21 @@ print_gnu_property_note (Filedata * filedata, Elf_Internal_Note * pnote)
 	      goto next;
 
 	    default:
+	      if ((type >= GNU_PROPERTY_UINT32_AND_LO
+		   && type <= GNU_PROPERTY_UINT32_AND_HI)
+		  || (type >= GNU_PROPERTY_UINT32_OR_LO
+		      && type <= GNU_PROPERTY_UINT32_OR_HI))
+		{
+		  if (type <= GNU_PROPERTY_UINT32_AND_HI)
+		    printf (_("UINT32_AND (%#x): "), type);
+		  else
+		    printf (_("UINT32_OR (%#x): "), type);
+		  if (datasz != 4)
+		    printf (_("<corrupt length: %#x> "), datasz);
+		  else
+		    printf ("%#x", (unsigned int) byte_get (ptr, 4));
+		  goto next;
+		}
 	      break;
 	    }
 	}
diff --git a/include/elf/common.h b/include/elf/common.h
index e7d55ae0782..a3b7db8bc43 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -766,6 +766,16 @@
 #define GNU_PROPERTY_STACK_SIZE			1
 #define GNU_PROPERTY_NO_COPY_ON_PROTECTED	2
 
+/* A 4-byte unsigned integer property: A bit is set if it is set in all
+   relocatable inputs.  */
+#define GNU_PROPERTY_UINT32_AND_LO	0xb0000000
+#define GNU_PROPERTY_UINT32_AND_HI	0xb0007fff
+
+/* A 4-byte unsigned integer property: A bit is set if it is set in any
+   relocatable inputs.  */
+#define GNU_PROPERTY_UINT32_OR_LO	0xb0008000
+#define GNU_PROPERTY_UINT32_OR_HI	0xb000ffff
+
 /* Processor-specific semantics, lo */
 #define GNU_PROPERTY_LOPROC  0xc0000000
 /* Processor-specific semantics, hi */
diff --git a/ld/testsuite/ld-elf/property-and-1.d b/ld/testsuite/ld-elf/property-and-1.d
new file mode 100644
index 00000000000..4caf18c2000
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-1.d
@@ -0,0 +1,7 @@
+#source: empty.s
+#source: property-and-1.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
+
diff --git a/ld/testsuite/ld-elf/property-and-1.s b/ld/testsuite/ld-elf/property-and-1.s
new file mode 100644
index 00000000000..3cff33da2d9
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-1.s
@@ -0,0 +1,15 @@
+	.section ".note.gnu.property", "a"
+	.p2align ALIGN
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+	.p2align ALIGN
+2:	.long 0xb0007fff	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x3
+4:
+	.p2align ALIGN
+5:
diff --git a/ld/testsuite/ld-elf/property-and-2.d b/ld/testsuite/ld-elf/property-and-2.d
new file mode 100644
index 00000000000..2229243e275
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-2.d
@@ -0,0 +1,8 @@
+#source: property-and-1.s
+#source: empty.s
+#source: property-and-2.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
+
diff --git a/ld/testsuite/ld-elf/property-and-2.s b/ld/testsuite/ld-elf/property-and-2.s
new file mode 100644
index 00000000000..7149cb2d52b
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-2.s
@@ -0,0 +1,15 @@
+	.section ".note.gnu.property", "a"
+	.p2align ALIGN
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+	.p2align ALIGN
+2:	.long 0xb0007fff	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x101
+4:
+	.p2align ALIGN
+5:
diff --git a/ld/testsuite/ld-elf/property-and-3.d b/ld/testsuite/ld-elf/property-and-3.d
new file mode 100644
index 00000000000..fc9134441c3
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-3.d
@@ -0,0 +1,8 @@
+#source: property-and-1.s
+#source: property-and-empty.s
+#source: property-and-2.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
+
diff --git a/ld/testsuite/ld-elf/property-and-3.s b/ld/testsuite/ld-elf/property-and-3.s
new file mode 100644
index 00000000000..2838c9aef30
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-3.s
@@ -0,0 +1,15 @@
+	.section ".note.gnu.property", "a"
+	.p2align ALIGN
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+	.p2align ALIGN
+2:	.long 0xb0007fff	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x1001
+4:
+	.p2align ALIGN
+5:
diff --git a/ld/testsuite/ld-elf/property-and-4.d b/ld/testsuite/ld-elf/property-and-4.d
new file mode 100644
index 00000000000..84bf404383f
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-4.d
@@ -0,0 +1,12 @@
+#source: property-and-1.s
+#source: property-and-2.s
+#source: property-and-3.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
+
+Displaying notes found in: .note.gnu.property
+[ 	]+Owner[ 	]+Data size[ 	]+Description
+  GNU                  0x[0-9a-f]+	NT_GNU_PROPERTY_TYPE_0
+      Properties: UINT32_AND \(0xb0007fff\): 0x1
diff --git a/ld/testsuite/ld-elf/property-and-empty.s b/ld/testsuite/ld-elf/property-and-empty.s
new file mode 100644
index 00000000000..02669adf1f8
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-empty.s
@@ -0,0 +1,15 @@
+	.section ".note.gnu.property", "a"
+	.p2align ALIGN
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+	.p2align ALIGN
+2:	.long 0xb0007fff	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x0
+4:
+	.p2align ALIGN
+5:
diff --git a/ld/testsuite/ld-elf/property-or-1.d b/ld/testsuite/ld-elf/property-or-1.d
new file mode 100644
index 00000000000..f5392c42cf9
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-or-1.d
@@ -0,0 +1,11 @@
+#source: empty.s
+#source: property-or-1.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
+
+Displaying notes found in: .note.gnu.property
+[ 	]+Owner[ 	]+Data size[ 	]+Description
+  GNU                  0x[0-9a-f]+	NT_GNU_PROPERTY_TYPE_0
+      Properties: UINT32_OR \(0xb000ffff\): 0x3
diff --git a/ld/testsuite/ld-elf/property-or-1.s b/ld/testsuite/ld-elf/property-or-1.s
new file mode 100644
index 00000000000..a4714180c17
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-or-1.s
@@ -0,0 +1,15 @@
+	.section ".note.gnu.property", "a"
+	.p2align ALIGN
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+	.p2align ALIGN
+2:	.long 0xb000ffff	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x3
+4:
+	.p2align ALIGN
+5:
diff --git a/ld/testsuite/ld-elf/property-or-2.d b/ld/testsuite/ld-elf/property-or-2.d
new file mode 100644
index 00000000000..85b754833cb
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-or-2.d
@@ -0,0 +1,12 @@
+#source: property-or-1.s
+#source: empty.s
+#source: property-or-2.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
+
+Displaying notes found in: .note.gnu.property
+[ 	]+Owner[ 	]+Data size[ 	]+Description
+  GNU                  0x[0-9a-f]+	NT_GNU_PROPERTY_TYPE_0
+      Properties: UINT32_OR \(0xb000ffff\): 0x103
diff --git a/ld/testsuite/ld-elf/property-or-2.s b/ld/testsuite/ld-elf/property-or-2.s
new file mode 100644
index 00000000000..a26047dab32
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-or-2.s
@@ -0,0 +1,15 @@
+	.section ".note.gnu.property", "a"
+	.p2align ALIGN
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+	.p2align ALIGN
+2:	.long 0xb000ffff	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x101
+4:
+	.p2align ALIGN
+5:
diff --git a/ld/testsuite/ld-elf/property-or-3.d b/ld/testsuite/ld-elf/property-or-3.d
new file mode 100644
index 00000000000..2d687db4a61
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-or-3.d
@@ -0,0 +1,12 @@
+#source: property-or-1.s
+#source: property-and-empty.s
+#source: property-or-2.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
+
+Displaying notes found in: .note.gnu.property
+[ 	]+Owner[ 	]+Data size[ 	]+Description
+  GNU                  0x[0-9a-f]+	NT_GNU_PROPERTY_TYPE_0
+      Properties: UINT32_OR \(0xb000ffff\): 0x103
diff --git a/ld/testsuite/ld-elf/property-or-3.s b/ld/testsuite/ld-elf/property-or-3.s
new file mode 100644
index 00000000000..d3e7367ea49
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-or-3.s
@@ -0,0 +1,15 @@
+	.section ".note.gnu.property", "a"
+	.p2align ALIGN
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+	.p2align ALIGN
+2:	.long 0xb000ffff	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x1001
+4:
+	.p2align ALIGN
+5:
diff --git a/ld/testsuite/ld-elf/property-or-4.d b/ld/testsuite/ld-elf/property-or-4.d
new file mode 100644
index 00000000000..fee22b155c6
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-or-4.d
@@ -0,0 +1,12 @@
+#source: property-or-1.s
+#source: property-or-2.s
+#source: property-or-3.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
+
+Displaying notes found in: .note.gnu.property
+[ 	]+Owner[ 	]+Data size[ 	]+Description
+  GNU                  0x[0-9a-f]+	NT_GNU_PROPERTY_TYPE_0
+      Properties: UINT32_OR \(0xb000ffff\): 0x1103
diff --git a/ld/testsuite/ld-elf/property-or-empty.s b/ld/testsuite/ld-elf/property-or-empty.s
new file mode 100644
index 00000000000..f37e1dc7d69
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-or-empty.s
@@ -0,0 +1,15 @@
+	.section ".note.gnu.property", "a"
+	.p2align ALIGN
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+	.p2align ALIGN
+2:	.long 0xb000ffff	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x0
+4:
+	.p2align ALIGN
+5:
-- 
2.29.2


  reply	other threads:[~2021-01-21 15:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 17:06 H.J. Lu
2021-01-21 15:02 ` H.J. Lu [this message]
2021-01-21 21:42   ` Fangrui Song
2021-04-17 12:48     ` H.J. Lu
2021-04-17 18:25       ` Fangrui Song
2021-04-17 19:05         ` H.J. Lu
2021-06-17 18:59   ` H.J. Lu
2021-06-17 19:38     ` [llvm-dev] " Fangrui Song
2021-06-17 19:45       ` H.J. Lu
2021-06-17 20:25         ` Fāng-ruì Sòng
2021-06-17 23:01           ` H.J. Lu
2021-06-18  0:06             ` Fāng-ruì Sòng
2021-06-18  0:24               ` H.J. Lu
2021-06-18  0:49                 ` Fāng-ruì Sòng
2021-06-18  2:40                   ` H.J. Lu
2021-06-21 14:35                     ` Michael Matz
2021-06-22 14:30                       ` H.J. Lu
2021-06-22 14:54                         ` Michael Matz
2021-06-18  2:45                   ` H.J. Lu
2021-06-18 15:38 ` RFC: Add GNU_PROPERTY_1_NEEDED H.J. Lu
2021-06-18 21:34   ` [llvm-dev] " Fangrui Song
2021-06-19  1:09     ` H.J. Lu
2021-09-27 14:22 RFC: Add GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX GNU gABI gnu-gabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOoG6NtMFp=jdj9yKPqoWbQ0932OodVRVcVsCUxhi8dLnQ@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gcc@gcc.gnu.org \
    --cc=gnu-gabi@sourceware.org \
    --cc=libc-alpha@sourceware.org \
    --cc=llvm-dev@lists.llvm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).