aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-06-18 07:18:02 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-06-18 07:19:01 -0700
commit5a767724d7e4d8dfe70a82edceaeaa6d57ff2b84 (patch)
tree003f3353aeeda64e64ce591c1a70d66380f4195e /ld
parent982c3a65ca5dbea8d6de3afd934f0a06fef54383 (diff)
downloadgdb-5a767724d7e4d8dfe70a82edceaeaa6d57ff2b84.zip
gdb-5a767724d7e4d8dfe70a82edceaeaa6d57ff2b84.tar.gz
gdb-5a767724d7e4d8dfe70a82edceaeaa6d57ff2b84.tar.bz2
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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog19
-rw-r--r--ld/testsuite/ld-elf/property-and-1.d6
-rw-r--r--ld/testsuite/ld-elf/property-and-1.s15
-rw-r--r--ld/testsuite/ld-elf/property-and-2.d7
-rw-r--r--ld/testsuite/ld-elf/property-and-2.s15
-rw-r--r--ld/testsuite/ld-elf/property-and-3.d7
-rw-r--r--ld/testsuite/ld-elf/property-and-3.s15
-rw-r--r--ld/testsuite/ld-elf/property-and-4.d12
-rw-r--r--ld/testsuite/ld-elf/property-and-empty.s15
-rw-r--r--ld/testsuite/ld-elf/property-or-1.d11
-rw-r--r--ld/testsuite/ld-elf/property-or-1.s15
-rw-r--r--ld/testsuite/ld-elf/property-or-2.d12
-rw-r--r--ld/testsuite/ld-elf/property-or-2.s15
-rw-r--r--ld/testsuite/ld-elf/property-or-3.d12
-rw-r--r--ld/testsuite/ld-elf/property-or-3.s15
-rw-r--r--ld/testsuite/ld-elf/property-or-4.d12
-rw-r--r--ld/testsuite/ld-elf/property-or-empty.s15
17 files changed, 218 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 37a373b..27434d6 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,22 @@
+2021-06-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2021-06-17 H.J. Lu <hongjiu.lu@intel.com>
PR ld/27973
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 0000000..480d16e
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-1.d
@@ -0,0 +1,6 @@
+#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 0000000..3cff33d
--- /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 0000000..007ba48
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-2.d
@@ -0,0 +1,7 @@
+#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 0000000..7149cb2
--- /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 0000000..8d5e579
--- /dev/null
+++ b/ld/testsuite/ld-elf/property-and-3.d
@@ -0,0 +1,7 @@
+#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 0000000..2838c9a
--- /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 0000000..84bf404
--- /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 0000000..02669ad
--- /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 0000000..f5392c4
--- /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 0000000..a471418
--- /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 0000000..85b7548
--- /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 0000000..a26047d
--- /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 0000000..2d687db
--- /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 0000000..d3e7367
--- /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 0000000..fee22b1
--- /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 0000000..f37e1dc
--- /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: