[PATCH v2 4/4] Arm tests: add permissions constraints to sections in custom linker scripts
Matthieu Longo
matthieu.longo@arm.com
Tue May 20 10:05:22 GMT 2025
This patch is addressing the same issues as the previous one for AArch64
tests, and removes the linker warning about RWX permissions on a segment.
See the previous patch description for more information.
---
ld/testsuite/ld-arm/arm.ld | 21 +++++++++++++----
ld/testsuite/ld-arm/cortex-a8-fix-plt.ld | 30 ++++++++++++++++--------
2 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/ld/testsuite/ld-arm/arm.ld b/ld/testsuite/ld-arm/arm.ld
index 5e76c4658d2..e55b73a652b 100644
--- a/ld/testsuite/ld-arm/arm.ld
+++ b/ld/testsuite/ld-arm/arm.ld
@@ -4,20 +4,33 @@ ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
- PROVIDE (__executable_start = 0x8000); . = 0x8000;
+ PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x8000));
+ . = SEGMENT_START("text-segment", 0x8000);
+
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
.text :
{
*(.before)
- *(.text)
+ *(.text .text.*)
*(.after)
*(.ARM.extab*)
*(.glue_7)
*(.v4_bx)
} =0
+ .rodata : { *(.rodata .rodata.*) }
.ARM.exidx : { *(.ARM.exidx*) }
+ . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1));
+ . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+ .dynamic : { *(.dynamic) }
. = 0x9000;
- .got : { *(.got) *(.got.plt)}
+ .got : { *(.got) *(.got.plt)}
+ .data : { *(.data) }
+ .bss : { *(.bss) }
+ .rodata : { *(.rodata .rodata.*) }
.ARM.attributes 0 : { *(.ARM.attributes) }
. = 0x12340000;
- .far : { *(.far) }
+ .far : { *(.far) } =0
}
diff --git a/ld/testsuite/ld-arm/cortex-a8-fix-plt.ld b/ld/testsuite/ld-arm/cortex-a8-fix-plt.ld
index 3103f671289..d19cadf0a78 100644
--- a/ld/testsuite/ld-arm/cortex-a8-fix-plt.ld
+++ b/ld/testsuite/ld-arm/cortex-a8-fix-plt.ld
@@ -1,18 +1,28 @@
OUTPUT_ARCH(arm)
ENTRY(_start)
+PHDRS
+{
+ phdr_phdrs PT_PHDR PHDRS;
+ phdr_text PT_LOAD PHDRS FLAGS(5); /* read + execute */
+ phdr_rodata PT_LOAD FLAGS(4); /* read */
+ phdr_data PT_LOAD FLAGS(6); /* read + write */
+ phdr_dynamic PT_DYNAMIC;
+ phdr_notes PT_NOTE FLAGS(4);
+}
SECTIONS
{
- . = 0x07000;
- .hash : { *(.hash) }
- .gnu.hash : { *(.gnu.hash) }
- .dynsym : { *(.dynsym) }
- .dynstr : { *(.dynstr) }
- .rel.dyn : { *(.rel.dyn) }
- .rel.plt : { *(.rel.plt) }
+ PROVIDE(__executable_start = 0x07000);
+ . = 0x07000 + SIZEOF_HEADERS;
+ .hash : { *(.hash) } :phdr_rodata
+ .gnu.hash : { *(.gnu.hash) } :phdr_rodata
+ .dynsym : { *(.dynsym) } :phdr_data
+ .dynstr : { *(.dynstr) } :phdr_data
+ .rel.dyn : { *(.rel.dyn) } :phdr_rodata
+ .rel.plt : { *(.rel.plt) } :phdr_rodata
. = 0x08000;
- .plt : { *(.plt) }
+ .plt : { *(.plt) } :phdr_text
. = 0x08ff0;
- .text : { *(.text) }
+ .text : { *(.text) } :phdr_text
. = 0x10000;
- .dynamic : { *(.dynamic) }
+ .dynamic : { *(.dynamic) } :phdr_data :phdr_dynamic
}
--
2.49.0
More information about the Binutils
mailing list