+2021-06-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2021-06-11 Alan Modra <amodra@gmail.com>
PR 27952
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;
}
}
{
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;
+ bool updated;
if (bed->merge_gnu_properties != NULL
&& pr_type >= GNU_PROPERTY_LOPROC
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 ();
}
+2021-06-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2021-06-15 Nick Clifton <nickc@redhat.com>
* readelf.c (get_note_type): Add support for NT_GO_BUILDID.
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;
}
}
+2021-06-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2021-06-15 Nick Clifton <nickc@redhat.com>
* elf/common.h (NT_GO_BUILDID): Define.
#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 */
+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
--- /dev/null
+#source: empty.s
+#source: property-and-1.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
--- /dev/null
+ .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:
--- /dev/null
+#source: property-and-1.s
+#source: empty.s
+#source: property-and-2.s
+#as:
+#ld: -shared
+#readelf: -n
+#xfail: ![check_shared_lib_support]
--- /dev/null
+ .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:
--- /dev/null
+#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]
--- /dev/null
+ .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:
--- /dev/null
+#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
--- /dev/null
+ .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:
--- /dev/null
+#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
--- /dev/null
+ .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:
--- /dev/null
+#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
--- /dev/null
+ .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:
--- /dev/null
+#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
--- /dev/null
+ .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:
--- /dev/null
+#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
--- /dev/null
+ .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: