]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
AArch64 BTI/PAC PLT tests: remove RWX permissions on segments
authorMatthieu Longo <matthieu.longo@arm.com>
Wed, 21 May 2025 10:19:48 +0000 (11:19 +0100)
committerMatthieu Longo <matthieu.longo@arm.com>
Wed, 11 Jun 2025 11:11:22 +0000 (12:11 +0100)
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

18 files changed:
ld/testsuite/ld-aarch64/protections/bti-and-memory-seal-plt-1-a.d
ld/testsuite/ld-aarch64/protections/bti-far-1.d
ld/testsuite/ld-aarch64/protections/bti-far-opt.d
ld/testsuite/ld-aarch64/protections/bti-far.ld
ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-a.d
ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-b.d
ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-a.d
ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-b.d
ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-a.d
ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-b.d
ld/testsuite/ld-aarch64/protections/bti-plt-1-a.d
ld/testsuite/ld-aarch64/protections/bti-plt-1-b.d
ld/testsuite/ld-aarch64/protections/bti-plt-1-c.d
ld/testsuite/ld-aarch64/protections/bti-plt-3.d
ld/testsuite/ld-aarch64/protections/bti-plt.ld
ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d
ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d
ld/testsuite/ld-aarch64/protections/pac-plt-2.d

index f8b1c214b2ba3654f6aaa423561e9f3323be78b5..7409525084cc28a553ff61dc50ea371f3fd24d10 100644 (file)
@@ -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
index 63fbb43c136f3b88f454bd4b38677ec043535337..eb295cffbe8514beebf4505af69d312a32caf147 100644 (file)
@@ -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
index cb293b6e90e6812c5b79806453360aed49f581e2..f5038c0cb7256669506997bc11862d9f4ab2ef94 100644 (file)
@@ -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
index 214b8cb919e735e1a164db9970ae4165e922734a..1568f184a302ed74d94caadf3cc34188e6072b63 100644 (file)
@@ -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)) }
 }
index 96268d3e7d46ebb4537f69246997880e5428ba43..4ab1ca82e2e4dfcb6bda5249f5fb464178bdb5f7 100644 (file)
@@ -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
index 041bf22415d13c74cb1c72d9e87b86554d19ee41..ef744e16f95ffbe1688adbbd97d833d2757001cf 100644 (file)
@@ -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
index f1ae3cd9b09445b259bcc2d3fcd1ab17a5c19c0d..0e87bccbd3b8c09c612980b5cc3872d1fdeab833 100644 (file)
@@ -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
index 69ccaab4993c668444b35efe1d669bf3f9ca2b36..199585c204d520ad94f69dd23e41b9912b53d2a0 100644 (file)
@@ -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
index c0c0bdb2af0976ab300bb8dbb8b50878945a9a58..1789a98f37d7dda1006d427223ee3efbf937f3d9 100644 (file)
@@ -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
index 89a08ae6b7c0d83e3b35fa990114548f8136ac1a..a0643ab62d4c03134d0e777cacd9e503ceda80e1 100644 (file)
@@ -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
index 2dc38647417ad6d12403ec15f97dfbd072c33bc4..89c0abc8ca0990b43f6fd3105c7170cd4fbc3483 100644 (file)
@@ -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
index 4b0e424f77ebb8d049c450bf7eb6a86b06257fe4..c889c1c9c46755e35b91232bbdb254f5ed576a8a 100644 (file)
@@ -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
index 2fd0dea08cd291cd9c89f6f32a07b5d14d1b8600..c200b0c2dbf69dc9dafcfbd0ec0137f84a9f824e 100644 (file)
@@ -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
index e457babb4cedb6d7473039c695adbf56f84481f7..48db4341b71099f60dcc13da1b76e030a96ea39e 100644 (file)
@@ -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
index cab4209186965c0629ebc50c0ab1d814b0ad9f82..c930fc8c37229a4957b37a2d750aabfada7032fc 100644 (file)
@@ -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)) }
 }
index fc10ec7070b5af48f8bcc5da3cfd240cfeb3abbd..203cb12d11bd8025bbebdc3548d66ad2fc23e2f0 100644 (file)
@@ -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
index 7a0fd59718d81cfe2b2f3f43e6cbe9c88be5a92b..6592689ff5fee86a93b843ff9690e1acc3c93e53 100644 (file)
@@ -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
index 1c3d7f4b1317e38f3ad7fe2d7cbe80e50397b842..67956451b8e4641983646e13214bd93087875912 100644 (file)
@@ -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