|
|
cf4a45 |
# Do not enable IBT when an object file contains code but no GNU Property notes. (#1687774)
|
|
|
cf4a45 |
|
|
|
cf4a45 |
diff -rup binutils.orig/bfd/elfxx-x86.c binutils-2.30/bfd/elfxx-x86.c
|
|
|
cf4a45 |
--- binutils.orig/bfd/elfxx-x86.c 2019-03-13 10:19:07.715406452 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/bfd/elfxx-x86.c 2019-03-13 10:20:01.255975385 +0000
|
|
|
cf4a45 |
@@ -2377,6 +2377,9 @@ _bfd_x86_elf_merge_gnu_properties (struc
|
|
|
cf4a45 |
}
|
|
|
cf4a45 |
else
|
|
|
cf4a45 |
{
|
|
|
cf4a45 |
+ /* There should be no AND properties since some input doesn't
|
|
|
cf4a45 |
+ have them. Set IBT and SHSTK properties for -z ibt and -z
|
|
|
cf4a45 |
+ shstk if needed. */
|
|
|
cf4a45 |
features = 0;
|
|
|
cf4a45 |
if (info->ibt)
|
|
|
cf4a45 |
features = GNU_PROPERTY_X86_FEATURE_1_IBT;
|
|
|
cf4a45 |
@@ -2384,18 +2387,15 @@ _bfd_x86_elf_merge_gnu_properties (struc
|
|
|
cf4a45 |
features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
|
|
|
cf4a45 |
if (features)
|
|
|
cf4a45 |
{
|
|
|
cf4a45 |
- /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
|
|
|
cf4a45 |
- GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
|
|
|
cf4a45 |
if (aprop != NULL)
|
|
|
cf4a45 |
{
|
|
|
cf4a45 |
- number = aprop->u.number;
|
|
|
cf4a45 |
- aprop->u.number = number | features;
|
|
|
cf4a45 |
- updated = number != (unsigned int) aprop->u.number;
|
|
|
cf4a45 |
+ updated = features != (unsigned int) aprop->u.number;
|
|
|
cf4a45 |
+ aprop->u.number = features;
|
|
|
cf4a45 |
}
|
|
|
cf4a45 |
else
|
|
|
cf4a45 |
{
|
|
|
cf4a45 |
- bprop->u.number |= features;
|
|
|
cf4a45 |
updated = TRUE;
|
|
|
cf4a45 |
+ bprop->u.number = features;
|
|
|
cf4a45 |
}
|
|
|
cf4a45 |
}
|
|
|
cf4a45 |
else if (aprop != NULL)
|
|
|
cf4a45 |
diff -rup binutils.orig/ld/testsuite/ld-i386/i386.exp binutils-2.30/ld/testsuite/ld-i386/i386.exp
|
|
|
cf4a45 |
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2019-03-13 10:19:07.258410131 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-i386/i386.exp 2019-03-13 10:20:32.995719837 +0000
|
|
|
cf4a45 |
@@ -473,6 +473,8 @@ run_dump_test "pr18815"
|
|
|
cf4a45 |
run_dump_test "pr19939a"
|
|
|
cf4a45 |
run_dump_test "pr19939b"
|
|
|
cf4a45 |
run_dump_test "tlsdesc2"
|
|
|
cf4a45 |
+run_dump_test "pr24322a"
|
|
|
cf4a45 |
+run_dump_test "pr24322b"
|
|
|
cf4a45 |
|
|
|
cf4a45 |
proc undefined_weak {cflags ldflags} {
|
|
|
cf4a45 |
set testname "Undefined weak symbol"
|
|
|
cf4a45 |
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp
|
|
|
cf4a45 |
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2019-03-13 10:19:07.323409608 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2019-03-13 10:21:11.938406302 +0000
|
|
|
cf4a45 |
@@ -593,6 +593,10 @@ run_dump_test "pr20253-5a"
|
|
|
cf4a45 |
run_dump_test "pr20253-5b"
|
|
|
cf4a45 |
run_dump_test "tlsdesc2"
|
|
|
cf4a45 |
run_dump_test "pr22048"
|
|
|
cf4a45 |
+run_dump_test "pr24322a"
|
|
|
cf4a45 |
+run_dump_test "pr24322a-x32"
|
|
|
cf4a45 |
+run_dump_test "pr24322b"
|
|
|
cf4a45 |
+run_dump_test "pr24322b-x32"
|
|
|
cf4a45 |
|
|
|
cf4a45 |
proc undefined_weak {cflags ldflags} {
|
|
|
cf4a45 |
set testname "Undefined weak symbol"
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-i386/pr24322a.d 2019-03-13 11:05:58.557068529 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,11 @@
|
|
|
cf4a45 |
+#source: ../ld-x86-64/pr24322a.s
|
|
|
cf4a45 |
+#source: ../ld-x86-64/pr24322b.s
|
|
|
cf4a45 |
+#as: --32
|
|
|
cf4a45 |
+#ld: -z shstk -m elf_i386
|
|
|
cf4a45 |
+#readelf: -n
|
|
|
cf4a45 |
+
|
|
|
cf4a45 |
+Displaying notes found in: .note.gnu.property
|
|
|
cf4a45 |
+ Owner Data size Description
|
|
|
cf4a45 |
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
|
|
|
cf4a45 |
+ Properties: x86 feature: SHSTK
|
|
|
cf4a45 |
+
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-i386/pr24322b.d 2019-03-13 11:07:19.837414751 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,11 @@
|
|
|
cf4a45 |
+#source: ../ld-x86-64/pr24322c.s
|
|
|
cf4a45 |
+#source: ../ld-x86-64/pr24322b.s
|
|
|
cf4a45 |
+#as: --32
|
|
|
cf4a45 |
+#ld: -z shstk -m elf_i386
|
|
|
cf4a45 |
+#readelf: -n
|
|
|
cf4a45 |
+
|
|
|
cf4a45 |
+Displaying notes found in: .note.gnu.property
|
|
|
cf4a45 |
+ Owner Data size Description
|
|
|
cf4a45 |
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
|
|
|
cf4a45 |
+ Properties: x86 feature: SHSTK
|
|
|
cf4a45 |
+
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322a.s 2019-03-13 10:20:01.256975377 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,27 @@
|
|
|
cf4a45 |
+ .section ".note.gnu.property", "a"
|
|
|
cf4a45 |
+.ifdef __64_bit__
|
|
|
cf4a45 |
+ .p2align 3
|
|
|
cf4a45 |
+.else
|
|
|
cf4a45 |
+ .p2align 2
|
|
|
cf4a45 |
+.endif
|
|
|
cf4a45 |
+ .long 1f - 0f /* name length */
|
|
|
cf4a45 |
+ .long 5f - 2f /* data length */
|
|
|
cf4a45 |
+ .long 5 /* note type */
|
|
|
cf4a45 |
+0: .asciz "GNU" /* vendor name */
|
|
|
cf4a45 |
+1:
|
|
|
cf4a45 |
+.ifdef __64_bit__
|
|
|
cf4a45 |
+ .p2align 3
|
|
|
cf4a45 |
+.else
|
|
|
cf4a45 |
+ .p2align 2
|
|
|
cf4a45 |
+.endif
|
|
|
cf4a45 |
+2: .long 0xc0000002 /* pr_type. */
|
|
|
cf4a45 |
+ .long 4f - 3f /* pr_datasz. */
|
|
|
cf4a45 |
+3:
|
|
|
cf4a45 |
+ .long 0x3
|
|
|
cf4a45 |
+4:
|
|
|
cf4a45 |
+.ifdef __64_bit__
|
|
|
cf4a45 |
+ .p2align 3
|
|
|
cf4a45 |
+.else
|
|
|
cf4a45 |
+ .p2align 2
|
|
|
cf4a45 |
+.endif
|
|
|
cf4a45 |
+5:
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322a.d 2019-03-13 11:07:47.228194433 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,10 @@
|
|
|
cf4a45 |
+#source: pr24322a.s
|
|
|
cf4a45 |
+#source: pr24322b.s
|
|
|
cf4a45 |
+#as: --64 -defsym __64_bit__=1
|
|
|
cf4a45 |
+#ld: -z shstk -melf_x86_64
|
|
|
cf4a45 |
+#readelf: -n
|
|
|
cf4a45 |
+
|
|
|
cf4a45 |
+Displaying notes found in: .note.gnu.property
|
|
|
cf4a45 |
+ Owner Data size Description
|
|
|
cf4a45 |
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
|
|
|
cf4a45 |
+ Properties: x86 feature: SHSTK
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322a-x32.d 2019-03-13 11:10:46.635235620 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,10 @@
|
|
|
cf4a45 |
+#source: pr24322a.s
|
|
|
cf4a45 |
+#source: pr24322b.s
|
|
|
cf4a45 |
+#as: --x32
|
|
|
cf4a45 |
+#ld: -z shstk -m elf32_x86_64
|
|
|
cf4a45 |
+#readelf: -n
|
|
|
cf4a45 |
+
|
|
|
cf4a45 |
+Displaying notes found in: .note.gnu.property
|
|
|
cf4a45 |
+ Owner Data size Description
|
|
|
cf4a45 |
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
|
|
|
cf4a45 |
+ Properties: x86 feature: SHSTK
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322b.s 2019-03-13 10:20:01.257975369 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,4 @@
|
|
|
cf4a45 |
+ .text
|
|
|
cf4a45 |
+ .global _start
|
|
|
cf4a45 |
+_start:
|
|
|
cf4a45 |
+ ret
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322b.d 2019-03-13 11:08:03.948059948 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,10 @@
|
|
|
cf4a45 |
+#source: pr24322c.s
|
|
|
cf4a45 |
+#source: pr24322b.s
|
|
|
cf4a45 |
+#as: --64 -defsym __64_bit__=1
|
|
|
cf4a45 |
+#ld: -z shstk -melf_x86_64
|
|
|
cf4a45 |
+#readelf: -n
|
|
|
cf4a45 |
+
|
|
|
cf4a45 |
+Displaying notes found in: .note.gnu.property
|
|
|
cf4a45 |
+ Owner Data size Description
|
|
|
cf4a45 |
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
|
|
|
cf4a45 |
+ Properties: x86 feature: SHSTK
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322b-x32.d 2019-03-13 11:13:13.626524410 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,10 @@
|
|
|
cf4a45 |
+#source: pr24322c.s
|
|
|
cf4a45 |
+#source: pr24322b.s
|
|
|
cf4a45 |
+#as: --x32
|
|
|
cf4a45 |
+#ld: -z shstk -m elf32_x86_64
|
|
|
cf4a45 |
+#readelf: -n
|
|
|
cf4a45 |
+
|
|
|
cf4a45 |
+Displaying notes found in: .note.gnu.property
|
|
|
cf4a45 |
+ Owner Data size Description
|
|
|
cf4a45 |
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
|
|
|
cf4a45 |
+ Properties: x86 feature: SHSTK
|
|
|
cf4a45 |
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
|
|
|
cf4a45 |
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322c.s 2019-03-13 10:20:01.257975369 +0000
|
|
|
cf4a45 |
@@ -0,0 +1,27 @@
|
|
|
cf4a45 |
+ .section ".note.gnu.property", "a"
|
|
|
cf4a45 |
+.ifdef __64_bit__
|
|
|
cf4a45 |
+ .p2align 3
|
|
|
cf4a45 |
+.else
|
|
|
cf4a45 |
+ .p2align 2
|
|
|
cf4a45 |
+.endif
|
|
|
cf4a45 |
+ .long 1f - 0f /* name length */
|
|
|
cf4a45 |
+ .long 5f - 2f /* data length */
|
|
|
cf4a45 |
+ .long 5 /* note type */
|
|
|
cf4a45 |
+0: .asciz "GNU" /* vendor name */
|
|
|
cf4a45 |
+1:
|
|
|
cf4a45 |
+.ifdef __64_bit__
|
|
|
cf4a45 |
+ .p2align 3
|
|
|
cf4a45 |
+.else
|
|
|
cf4a45 |
+ .p2align 2
|
|
|
cf4a45 |
+.endif
|
|
|
cf4a45 |
+2: .long 0xc0000002 /* pr_type. */
|
|
|
cf4a45 |
+ .long 4f - 3f /* pr_datasz. */
|
|
|
cf4a45 |
+3:
|
|
|
cf4a45 |
+ .long 0x0
|
|
|
cf4a45 |
+4:
|
|
|
cf4a45 |
+.ifdef __64_bit__
|
|
|
cf4a45 |
+ .p2align 3
|
|
|
cf4a45 |
+.else
|
|
|
cf4a45 |
+ .p2align 2
|
|
|
cf4a45 |
+.endif
|
|
|
cf4a45 |
+5:
|