[binutils-gdb] AArch64 BTI/PAC PLT tests: remove RWX permissions on segments
Matthieu Longo
mlongo@sourceware.org
Wed Jun 11 11:11:36 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1905f68578faeeb0f2bc89c51d254200471700e3
commit 1905f68578faeeb0f2bc89c51d254200471700e3
Author: Matthieu Longo <matthieu.longo@arm.com>
Date: Wed May 21 11:19:48 2025 +0100
AArch64 BTI/PAC PLT tests: remove RWX permissions on segments
The bti-far.ld and bti-plt.ld scripts don't provide information enough to the
linker to assess the right set of permisssions on segments (i.e. Read/Write/Execute).
This insufficiency caused the linker to bundle all the sections in a same segment
with the union of all the required permissions, i.e. RWX.
A segment with such lax permissions constitutes a security hole, so the linker
emits the following warning message:
<ELF file> has a LOAD segment with RWX permissions.
This warning message is noisy in the tests, and has no reason to exist.
This issue can be addressed in two ways:
- either by providing the right set of permissions on a section so that the
linker assigns them to a segment with compatible permissions.
- or by providing alignment constraints so that the linker can move the sections
automatically to a new segment and set the right permission for non-executable
data.
The second option seems to be the preferred approach, even if not explicitly
recommended. Examples of linker scripts for AArch64 are available at [1].
The fixes in bti-far.ld and bti-plt.ld are the same, except that bti-far.ld also
contains a ".far" section, to make sure that it generates the trampolines correctly.
[1]: https://developer.arm.com/documentation/dui0474/m/gnu-ld-script-support-in
-armlink/default-gnu-ld-scripts-used-by-armlink/default-ld-script-when
-building-an-executable?lang=en
Diff:
---
.../protections/bti-and-memory-seal-plt-1-a.d | 10 ++++-----
ld/testsuite/ld-aarch64/protections/bti-far-1.d | 4 ++--
ld/testsuite/ld-aarch64/protections/bti-far-opt.d | 4 ++--
ld/testsuite/ld-aarch64/protections/bti-far.ld | 26 +++++++++++++++++-----
.../ld-aarch64/protections/bti-pac-plt-1-a.d | 6 ++---
.../ld-aarch64/protections/bti-pac-plt-1-b.d | 6 ++---
.../ld-aarch64/protections/bti-pac-plt-2-a.d | 6 ++---
.../ld-aarch64/protections/bti-pac-plt-2-b.d | 6 ++---
.../ld-aarch64/protections/bti-pac-plt-3-a.d | 6 ++---
.../ld-aarch64/protections/bti-pac-plt-3-b.d | 6 ++---
ld/testsuite/ld-aarch64/protections/bti-plt-1-a.d | 6 ++---
ld/testsuite/ld-aarch64/protections/bti-plt-1-b.d | 6 ++---
ld/testsuite/ld-aarch64/protections/bti-plt-1-c.d | 6 ++---
ld/testsuite/ld-aarch64/protections/bti-plt-3.d | 6 ++---
ld/testsuite/ld-aarch64/protections/bti-plt.ld | 25 ++++++++++++++++-----
ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d | 6 ++---
ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d | 6 ++---
ld/testsuite/ld-aarch64/protections/pac-plt-2.d | 4 ++--
18 files changed, 86 insertions(+), 59 deletions(-)
diff --git a/ld/testsuite/ld-aarch64/protections/bti-and-memory-seal-plt-1-a.d b/ld/testsuite/ld-aarch64/protections/bti-and-memory-seal-plt-1-a.d
index f8b1c214b2b..7409525084c 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-and-memory-seal-plt-1-a.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-and-memory-seal-plt-1-a.d
@@ -13,7 +13,7 @@ Disassembly of section \.plt:
[0-9]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -21,25 +21,25 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d61f0220 br x17
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d61f0220 br x17
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401a11 ldr x17, \[x16, #48\]
.*: 9100c210 add x16, x16, #0x30
.*: d61f0220 br x17
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401e11 ldr x17, \[x16, #56\]
.*: 9100e210 add x16, x16, #0x38
.*: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-1.d b/ld/testsuite/ld-aarch64/protections/bti-far-1.d
index 63fbb43c136..eb295cffbe8 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-1.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-1.d
@@ -13,7 +13,7 @@ Disassembly of section \.plt:
0000000000018000 <\.plt>:
18000: d503245f bti c
18004: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
- 18008: 900000d0 adrp x16, 30000 <_GLOBAL_OFFSET_TABLE_>
+ 18008: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
1800c: f9400e11 ldr x17, \[x16, #24\]
18010: 91006210 add x16, x16, #0x18
18014: d61f0220 br x17
@@ -21,7 +21,7 @@ Disassembly of section \.plt:
1801c: d503201f nop
0000000000018020 <foo@plt>:
- 18020: 900000d0 adrp x16, 30000 <_GLOBAL_OFFSET_TABLE_>
+ 18020: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
18024: f9401211 ldr x17, \[x16, #32\]
18028: 91008210 add x16, x16, #0x20
1802c: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-opt.d b/ld/testsuite/ld-aarch64/protections/bti-far-opt.d
index cb293b6e90e..f5038c0cb72 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-opt.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-opt.d
@@ -13,7 +13,7 @@ Disassembly of section \.plt:
0000000000018000 <\.plt>:
18000: d503245f bti c
18004: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
- 18008: 900000d0 adrp x16, 30000 <_GLOBAL_OFFSET_TABLE_>
+ 18008: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
1800c: f9400e11 ldr x17, \[x16, #24\]
18010: 91006210 add x16, x16, #0x18
18014: d61f0220 br x17
@@ -21,7 +21,7 @@ Disassembly of section \.plt:
1801c: d503201f nop
0000000000018020 <foo@plt>:
- 18020: 900000d0 adrp x16, 30000 <_GLOBAL_OFFSET_TABLE_>
+ 18020: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
18024: f9401211 ldr x17, \[x16, #32\]
18028: 91008210 add x16, x16, #0x20
1802c: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far.ld b/ld/testsuite/ld-aarch64/protections/bti-far.ld
index 214b8cb919e..1568f184a30 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far.ld
+++ b/ld/testsuite/ld-aarch64/protections/bti-far.ld
@@ -2,14 +2,28 @@ OUTPUT_ARCH(aarch64)
ENTRY(_start)
SECTIONS
{
+ PROVIDE(__executable_start = 0x8000);
+ . = SEGMENT_START("text-segment", 0x8000) + SIZEOF_HEADERS;
+ /* Start of the executable code region. */
+ .hash : { *(.hash) }
+ .gnu.hash : { *(.gnu.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
. = 0x10000;
- .rela.plt : { *(.rela.plt) *(.rela.iplt) }
+ .rela.dyn : { *(.rela.ifunc) }
+ .rela.plt : { *(.rela.plt) *(.rela.iplt) }
. = 0x18000;
- .plt : { *(.plt) *(.iplt) }
+ .plt : { *(.plt) *(.iplt) }
. = 0x20000;
- .text : { *(.text) }
- . = 0x30000;
- .got : { *(.got) *(.got.plt) }
+ .text : { *(.text) }
. = 0x12340000;
- .far : { *(.far) }
+ .far : { *(.far) }
+ /* Start of the Read Only Data region. */
+ .note.gnu-property : { *(.note.gnu-property) }
+
+ /* Start of the Read Write Data region. */
+ . = ALIGN (CONSTANT (MAXPAGESIZE));
+ .got : { *(.got) *(.got.plt) }
+ /* Start of the metadata region. */
+ .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
}
diff --git a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-a.d b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-a.d
index 96268d3e7d4..4ab1ca82e2e 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-a.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-a.d
@@ -11,7 +11,7 @@ Disassembly of section \.plt:
[0-9a-f]+ <\.plt>:
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -20,13 +20,13 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d61f0220 br x17
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-b.d b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-b.d
index 041bf22415d..ef744e16f95 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-b.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-b.d
@@ -16,7 +16,7 @@ Disassembly of section \.plt:
[0-9a-f]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -24,13 +24,13 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d61f0220 br x17
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-a.d b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-a.d
index f1ae3cd9b09..0e87bccbd3b 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-a.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-a.d
@@ -12,7 +12,7 @@ Disassembly of section \.plt:
[0-9a-f]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -20,7 +20,7 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d503219f autia1716
@@ -28,7 +28,7 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d503219f autia1716
diff --git a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-b.d b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-b.d
index 69ccaab4993..199585c204d 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-b.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-b.d
@@ -12,7 +12,7 @@ Disassembly of section \.plt:
[0-9]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -21,7 +21,7 @@ Disassembly of section \.plt:
[0-9]+ <.*>:
.*: d503245f bti c
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d503219f autia1716
@@ -29,7 +29,7 @@ Disassembly of section \.plt:
[0-9]+ <.*>:
.*: d503245f bti c
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d503219f autia1716
diff --git a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-a.d b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-a.d
index c0c0bdb2af0..1789a98f37d 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-a.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-a.d
@@ -12,7 +12,7 @@ Disassembly of section \.plt:
[0-9a-f]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -20,7 +20,7 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d503219f autia1716
@@ -28,7 +28,7 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d503219f autia1716
diff --git a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-b.d b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-b.d
index 89a08ae6b7c..a0643ab62d4 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-b.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-b.d
@@ -12,7 +12,7 @@ Disassembly of section \.plt:
[0-9]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -21,7 +21,7 @@ Disassembly of section \.plt:
[0-9]+ <.*>:
.*: d503245f bti c
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d503219f autia1716
@@ -29,7 +29,7 @@ Disassembly of section \.plt:
[0-9]+ <.*>:
.*: d503245f bti c
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d503219f autia1716
diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-1-a.d b/ld/testsuite/ld-aarch64/protections/bti-plt-1-a.d
index 2dc38647417..89c0abc8ca0 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-plt-1-a.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-plt-1-a.d
@@ -12,7 +12,7 @@ Disassembly of section \.plt:
[0-9]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -20,13 +20,13 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d61f0220 br x17
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-1-b.d b/ld/testsuite/ld-aarch64/protections/bti-plt-1-b.d
index 4b0e424f77e..c889c1c9c46 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-plt-1-b.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-plt-1-b.d
@@ -12,7 +12,7 @@ Disassembly of section \.plt:
[0-9]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -20,13 +20,13 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d61f0220 br x17
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-1-c.d b/ld/testsuite/ld-aarch64/protections/bti-plt-1-c.d
index 2fd0dea08cd..c200b0c2dbf 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-plt-1-c.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-plt-1-c.d
@@ -13,7 +13,7 @@ Disassembly of section \.plt:
[0-9]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -21,13 +21,13 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d61f0220 br x17
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-3.d b/ld/testsuite/ld-aarch64/protections/bti-plt-3.d
index e457babb4ce..48db4341b71 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-plt-3.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-plt-3.d
@@ -12,7 +12,7 @@ Disassembly of section \.plt:
[0-9]+ <\.plt>:
.*: d503245f bti c
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -21,7 +21,7 @@ Disassembly of section \.plt:
[0-9]+ <.*>:
.*: d503245f bti c
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d61f0220 br x17
@@ -29,7 +29,7 @@ Disassembly of section \.plt:
[0-9]+ <.*>:
.*: d503245f bti c
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt.ld b/ld/testsuite/ld-aarch64/protections/bti-plt.ld
index cab42091869..c930fc8c372 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-plt.ld
+++ b/ld/testsuite/ld-aarch64/protections/bti-plt.ld
@@ -2,13 +2,26 @@ OUTPUT_ARCH(aarch64)
ENTRY(_start)
SECTIONS
{
+ PROVIDE(__executable_start = 0x8000);
+ . = SEGMENT_START("text-segment", 0x8000) + SIZEOF_HEADERS;
+ /* Start of the executable code region. */
+ .hash : { *(.hash) }
+ .gnu.hash : { *(.gnu.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
. = 0x10000;
- .rela.plt : { *(.rela.plt) *(.rela.iplt) }
+ .rela.dyn : { *(.rela.ifunc) }
+ .rela.plt : { *(.rela.plt) *(.rela.iplt) }
. = 0x18000;
- .plt : { *(.plt) *(.iplt) }
+ .plt : { *(.plt) *(.iplt) }
. = 0x20000;
- .text : { *(.text) }
- . = 0x28000;
- .got : { *(.got) *(.got.plt) }
- .ARM.attributes 0 : { *(.ARM.attributes) }
+ .text : { *(.text) }
+ /* Start of the Read Only Data region. */
+ .note.gnu-property : { *(.note.gnu-property) }
+
+ /* Start of the Read Write Data region. */
+ . = ALIGN (CONSTANT (MAXPAGESIZE));
+ .got : { *(.got) *(.got.plt) }
+ /* Start of the metadata region. */
+ .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
}
diff --git a/ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d b/ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d
index fc10ec7070b..203cb12d11b 100644
--- a/ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d
+++ b/ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d
@@ -11,7 +11,7 @@ Disassembly of section \.plt:
[0-9]+ <.*>:
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -20,7 +20,7 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d503219f autia1716
@@ -28,7 +28,7 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d503219f autia1716
diff --git a/ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d b/ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d
index 7a0fd59718d..6592689ff5f 100644
--- a/ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d
+++ b/ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d
@@ -15,7 +15,7 @@ Disassembly of section \.plt:
[0-9a-f]+ <\.plt>:
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9400e11 ldr x17, \[x16, #24\]
.*: 91006210 add x16, x16, #0x18
.*: d61f0220 br x17
@@ -24,13 +24,13 @@ Disassembly of section \.plt:
.*: d503201f nop
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401211 ldr x17, \[x16, #32\]
.*: 91008210 add x16, x16, #0x20
.*: d61f0220 br x17
[0-9a-f]+ <.*>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401611 ldr x17, \[x16, #40\]
.*: 9100a210 add x16, x16, #0x28
.*: d61f0220 br x17
diff --git a/ld/testsuite/ld-aarch64/protections/pac-plt-2.d b/ld/testsuite/ld-aarch64/protections/pac-plt-2.d
index 1c3d7f4b131..67956451b8e 100644
--- a/ld/testsuite/ld-aarch64/protections/pac-plt-2.d
+++ b/ld/testsuite/ld-aarch64/protections/pac-plt-2.d
@@ -9,7 +9,7 @@ Disassembly of section \.plt:
.* \<.plt\>:
.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401a11 ldr x17, \[x16, #48\]
.*: 9100c210 add x16, x16, #0x30
.*: d61f0220 br x17
@@ -19,7 +19,7 @@ Disassembly of section \.plt:
.* \<__tls_get_addr@plt\>:
-.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: [[:xdigit:]]{8} adrp x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
.*: f9401e11 ldr x17, \[x16, #56\]
.*: 9100e210 add x16, x16, #0x38
.*: d503219f autia1716
More information about the Binutils-cvs
mailing list