|
|
381f6c |
diff -rup binutils.orig/bfd/elfxx-x86.c binutils-2.30/bfd/elfxx-x86.c
|
|
|
381f6c |
--- binutils.orig/bfd/elfxx-x86.c 2018-07-30 16:01:04.881710127 +0100
|
|
|
381f6c |
+++ binutils-2.30/bfd/elfxx-x86.c 2018-07-30 16:01:28.809447800 +0100
|
|
|
381f6c |
@@ -2320,13 +2320,34 @@ _bfd_x86_elf_merge_gnu_properties (struc
|
|
|
381f6c |
{
|
|
|
381f6c |
number = aprop->u.number;
|
|
|
381f6c |
aprop->u.number = number | bprop->u.number;
|
|
|
381f6c |
- updated = number != (unsigned int) aprop->u.number;
|
|
|
381f6c |
+ /* Remove the property if ISA bits are empty. */
|
|
|
381f6c |
+ if (aprop->u.number == 0)
|
|
|
381f6c |
+ {
|
|
|
381f6c |
+ aprop->pr_kind = property_remove;
|
|
|
381f6c |
+ updated = TRUE;
|
|
|
381f6c |
+ }
|
|
|
381f6c |
+ else
|
|
|
381f6c |
+ updated = number != (unsigned int) aprop->u.number;
|
|
|
381f6c |
}
|
|
|
381f6c |
else
|
|
|
381f6c |
{
|
|
|
381f6c |
- /* Return TRUE if APROP is NULL to indicate that BPROP should
|
|
|
381f6c |
- be added to ABFD. */
|
|
|
381f6c |
- updated = aprop == NULL;
|
|
|
381f6c |
+ /* Only one of APROP and BPROP can be NULL. */
|
|
|
381f6c |
+ if (aprop != NULL)
|
|
|
381f6c |
+ {
|
|
|
381f6c |
+ if (aprop->u.number == 0)
|
|
|
381f6c |
+ {
|
|
|
381f6c |
+ /* Remove APROP if ISA bits are empty. */
|
|
|
381f6c |
+ aprop->pr_kind = property_remove;
|
|
|
381f6c |
+ updated = TRUE;
|
|
|
381f6c |
+ }
|
|
|
381f6c |
+ }
|
|
|
381f6c |
+ else
|
|
|
381f6c |
+ {
|
|
|
381f6c |
+ /* Return TRUE if APROP is NULL and ISA bits of BPROP
|
|
|
381f6c |
+ aren't empty to indicate that BPROP should be added
|
|
|
381f6c |
+ to ABFD. */
|
|
|
381f6c |
+ updated = bprop->u.number != 0;
|
|
|
381f6c |
+ }
|
|
|
381f6c |
}
|
|
|
381f6c |
break;
|
|
|
381f6c |
|
|
|
381f6c |
diff -rup binutils.orig/ld/testsuite/ld-i386/i386.exp binutils-2.30/ld/testsuite/ld-i386/i386.exp
|
|
|
381f6c |
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2018-07-30 16:00:54.241826775 +0100
|
|
|
381f6c |
+++ binutils-2.30/ld/testsuite/ld-i386/i386.exp 2018-07-30 16:02:58.911459984 +0100
|
|
|
381f6c |
@@ -450,6 +450,8 @@ run_dump_test "pr22115-1b"
|
|
|
381f6c |
run_dump_test "pr22115-1c"
|
|
|
381f6c |
run_dump_test "pr22115-1d"
|
|
|
381f6c |
run_dump_test "pr22135"
|
|
|
381f6c |
+run_dump_test "pr23372a"
|
|
|
381f6c |
+run_dump_test "pr23372b"
|
|
|
381f6c |
|
|
|
381f6c |
if { !([istarget "i?86-*-linux*"]
|
|
|
381f6c |
|| [istarget "i?86-*-gnu*"]
|
|
|
381f6c |
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp
|
|
|
381f6c |
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2018-07-30 16:00:55.340814726 +0100
|
|
|
381f6c |
+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2018-07-30 16:03:32.624090383 +0100
|
|
|
381f6c |
@@ -379,6 +379,10 @@ run_dump_test "pr22115-1c-x32"
|
|
|
381f6c |
run_dump_test "pr22115-1d"
|
|
|
381f6c |
run_dump_test "pr22115-1d-x32"
|
|
|
381f6c |
run_dump_test "pr22135"
|
|
|
381f6c |
+run_dump_test "pr23372a"
|
|
|
381f6c |
+run_dump_test "pr23372a-x32"
|
|
|
381f6c |
+run_dump_test "pr23372b"
|
|
|
381f6c |
+run_dump_test "pr23372b-x32"
|
|
|
381f6c |
|
|
|
381f6c |
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
|
|
|
381f6c |
return
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-i386/pr23372a.d b/ld/testsuite/ld-i386/pr23372a.d
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..b75523bdc3
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-i386/pr23372a.d
|
|
|
381f6c |
@@ -0,0 +1,5 @@
|
|
|
381f6c |
+#source: pr23372a.s
|
|
|
381f6c |
+#source: pr23372b.s
|
|
|
381f6c |
+#as: --32
|
|
|
381f6c |
+#ld: -r -m elf_i386
|
|
|
381f6c |
+#readelf: -n
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-i386/pr23372a.s b/ld/testsuite/ld-i386/pr23372a.s
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..9849d620a1
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-i386/pr23372a.s
|
|
|
381f6c |
@@ -0,0 +1,18 @@
|
|
|
381f6c |
+ .section ".note.gnu.property", "a"
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+ .long 1f - 0f /* name length. */
|
|
|
381f6c |
+ .long 4f - 1f /* data length. */
|
|
|
381f6c |
+ /* NT_GNU_PROPERTY_TYPE_0 */
|
|
|
381f6c |
+ .long 5 /* note type. */
|
|
|
381f6c |
+0:
|
|
|
381f6c |
+ .asciz "GNU" /* vendor name. */
|
|
|
381f6c |
+1:
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+ /* GNU_PROPERTY_X86_ISA_1_USED */
|
|
|
381f6c |
+ .long 0xc0000000 /* pr_type. */
|
|
|
381f6c |
+ .long 3f - 2f /* pr_datasz. */
|
|
|
381f6c |
+2:
|
|
|
381f6c |
+ .long 0x0
|
|
|
381f6c |
+3:
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+4:
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-i386/pr23372b.d b/ld/testsuite/ld-i386/pr23372b.d
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..a8e9c819a4
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-i386/pr23372b.d
|
|
|
381f6c |
@@ -0,0 +1,5 @@
|
|
|
381f6c |
+#source: pr23372a.s
|
|
|
381f6c |
+#source: pr23372c.s
|
|
|
381f6c |
+#as: --32
|
|
|
381f6c |
+#ld: -r -m elf_i386
|
|
|
381f6c |
+#readelf: -n
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-i386/pr23372b.s b/ld/testsuite/ld-i386/pr23372b.s
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..9849d620a1
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-i386/pr23372b.s
|
|
|
381f6c |
@@ -0,0 +1,18 @@
|
|
|
381f6c |
+ .section ".note.gnu.property", "a"
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+ .long 1f - 0f /* name length. */
|
|
|
381f6c |
+ .long 4f - 1f /* data length. */
|
|
|
381f6c |
+ /* NT_GNU_PROPERTY_TYPE_0 */
|
|
|
381f6c |
+ .long 5 /* note type. */
|
|
|
381f6c |
+0:
|
|
|
381f6c |
+ .asciz "GNU" /* vendor name. */
|
|
|
381f6c |
+1:
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+ /* GNU_PROPERTY_X86_ISA_1_USED */
|
|
|
381f6c |
+ .long 0xc0000000 /* pr_type. */
|
|
|
381f6c |
+ .long 3f - 2f /* pr_datasz. */
|
|
|
381f6c |
+2:
|
|
|
381f6c |
+ .long 0x0
|
|
|
381f6c |
+3:
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+4:
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-i386/pr23372c.s b/ld/testsuite/ld-i386/pr23372c.s
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..3470dce649
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-i386/pr23372c.s
|
|
|
381f6c |
@@ -0,0 +1,18 @@
|
|
|
381f6c |
+ .section ".note.gnu.property", "a"
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+ .long 1f - 0f /* name length. */
|
|
|
381f6c |
+ .long 4f - 1f /* data length. */
|
|
|
381f6c |
+ /* NT_GNU_PROPERTY_TYPE_0 */
|
|
|
381f6c |
+ .long 5 /* note type. */
|
|
|
381f6c |
+0:
|
|
|
381f6c |
+ .asciz "GNU" /* vendor name. */
|
|
|
381f6c |
+1:
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+ /* GNU_PROPERTY_X86_ISA_1_NEEDED */
|
|
|
381f6c |
+ .long 0xc0000001 /* pr_type. */
|
|
|
381f6c |
+ .long 3f - 2f /* pr_datasz. */
|
|
|
381f6c |
+2:
|
|
|
381f6c |
+ .long 0x0
|
|
|
381f6c |
+3:
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+4:
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-x86-64/pr23372a-x32.d b/ld/testsuite/ld-x86-64/pr23372a-x32.d
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..9f93642364
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-x86-64/pr23372a-x32.d
|
|
|
381f6c |
@@ -0,0 +1,5 @@
|
|
|
381f6c |
+#source: pr23372a.s
|
|
|
381f6c |
+#source: pr23372b.s
|
|
|
381f6c |
+#as: --x32
|
|
|
381f6c |
+#ld: -r -m elf32_x86_64
|
|
|
381f6c |
+#readelf: -n
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-x86-64/pr23372a.d b/ld/testsuite/ld-x86-64/pr23372a.d
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..ee688fc2e2
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-x86-64/pr23372a.d
|
|
|
381f6c |
@@ -0,0 +1,5 @@
|
|
|
381f6c |
+#source: pr23372a.s
|
|
|
381f6c |
+#source: pr23372b.s
|
|
|
381f6c |
+#as: --64 -defsym __64_bit__=1
|
|
|
381f6c |
+#ld: -r -m elf_x86_64
|
|
|
381f6c |
+#readelf: -n
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-x86-64/pr23372a.s b/ld/testsuite/ld-x86-64/pr23372a.s
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..639fc26de4
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-x86-64/pr23372a.s
|
|
|
381f6c |
@@ -0,0 +1,30 @@
|
|
|
381f6c |
+ .section ".note.gnu.property", "a"
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+ .long 1f - 0f /* name length. */
|
|
|
381f6c |
+ .long 4f - 1f /* data length. */
|
|
|
381f6c |
+ /* NT_GNU_PROPERTY_TYPE_0 */
|
|
|
381f6c |
+ .long 5 /* note type. */
|
|
|
381f6c |
+0:
|
|
|
381f6c |
+ .asciz "GNU" /* vendor name. */
|
|
|
381f6c |
+1:
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+ /* GNU_PROPERTY_X86_ISA_1_USED */
|
|
|
381f6c |
+ .long 0xc0000000 /* pr_type. */
|
|
|
381f6c |
+ .long 3f - 2f /* pr_datasz. */
|
|
|
381f6c |
+2:
|
|
|
381f6c |
+ .long 0x0
|
|
|
381f6c |
+3:
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+4:
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-x86-64/pr23372b-x32.d b/ld/testsuite/ld-x86-64/pr23372b-x32.d
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..5b0cf98618
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-x86-64/pr23372b-x32.d
|
|
|
381f6c |
@@ -0,0 +1,5 @@
|
|
|
381f6c |
+#source: pr23372a.s
|
|
|
381f6c |
+#source: pr23372c.s
|
|
|
381f6c |
+#as: --x32
|
|
|
381f6c |
+#ld: -r -m elf32_x86_64
|
|
|
381f6c |
+#readelf: -n
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-x86-64/pr23372b.d b/ld/testsuite/ld-x86-64/pr23372b.d
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..727afa8ab5
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-x86-64/pr23372b.d
|
|
|
381f6c |
@@ -0,0 +1,5 @@
|
|
|
381f6c |
+#source: pr23372a.s
|
|
|
381f6c |
+#source: pr23372c.s
|
|
|
381f6c |
+#as: --64 -defsym __64_bit__=1
|
|
|
381f6c |
+#ld: -r -m elf_x86_64
|
|
|
381f6c |
+#readelf: -n
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-x86-64/pr23372b.s b/ld/testsuite/ld-x86-64/pr23372b.s
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..639fc26de4
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-x86-64/pr23372b.s
|
|
|
381f6c |
@@ -0,0 +1,30 @@
|
|
|
381f6c |
+ .section ".note.gnu.property", "a"
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+ .long 1f - 0f /* name length. */
|
|
|
381f6c |
+ .long 4f - 1f /* data length. */
|
|
|
381f6c |
+ /* NT_GNU_PROPERTY_TYPE_0 */
|
|
|
381f6c |
+ .long 5 /* note type. */
|
|
|
381f6c |
+0:
|
|
|
381f6c |
+ .asciz "GNU" /* vendor name. */
|
|
|
381f6c |
+1:
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+ /* GNU_PROPERTY_X86_ISA_1_USED */
|
|
|
381f6c |
+ .long 0xc0000000 /* pr_type. */
|
|
|
381f6c |
+ .long 3f - 2f /* pr_datasz. */
|
|
|
381f6c |
+2:
|
|
|
381f6c |
+ .long 0x0
|
|
|
381f6c |
+3:
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+4:
|
|
|
381f6c |
diff --git a/ld/testsuite/ld-x86-64/pr23372c.s b/ld/testsuite/ld-x86-64/pr23372c.s
|
|
|
381f6c |
new file mode 100644
|
|
|
381f6c |
index 0000000000..b4eaf69777
|
|
|
381f6c |
--- /dev/null
|
|
|
381f6c |
+++ b/ld/testsuite/ld-x86-64/pr23372c.s
|
|
|
381f6c |
@@ -0,0 +1,30 @@
|
|
|
381f6c |
+ .section ".note.gnu.property", "a"
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+ .long 1f - 0f /* name length. */
|
|
|
381f6c |
+ .long 4f - 1f /* data length. */
|
|
|
381f6c |
+ /* NT_GNU_PROPERTY_TYPE_0 */
|
|
|
381f6c |
+ .long 5 /* note type. */
|
|
|
381f6c |
+0:
|
|
|
381f6c |
+ .asciz "GNU" /* vendor name. */
|
|
|
381f6c |
+1:
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+ /* GNU_PROPERTY_X86_ISA_1_NEEDED */
|
|
|
381f6c |
+ .long 0xc0000001 /* pr_type. */
|
|
|
381f6c |
+ .long 3f - 2f /* pr_datasz. */
|
|
|
381f6c |
+2:
|
|
|
381f6c |
+ .long 0x0
|
|
|
381f6c |
+3:
|
|
|
381f6c |
+.ifdef __64_bit__
|
|
|
381f6c |
+ .p2align 3
|
|
|
381f6c |
+.else
|
|
|
381f6c |
+ .p2align 2
|
|
|
381f6c |
+.endif
|
|
|
381f6c |
+4:
|