[boot-wrapper PATCH 02/12] Output text separately from data

Mark Rutland mark.rutland at arm.com
Thu Jul 29 08:20:40 PDT 2021


Assembly files generally assume that .text is word-aligned, and don't
explciitly align the .text section. However, if we mix .text with data
sections at link time, we can output .text sections at less than word
alignment, resulting in boot-time hangs that are painful to debug.

Output all .text sections before .data sections to minimize this risk.

Signed-off-by: Mark Rutland <mark.rutland at arm.com>
---
 model.lds.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/model.lds.S b/model.lds.S
index 370ff56..d4e7e13 100644
--- a/model.lds.S
+++ b/model.lds.S
@@ -65,7 +65,8 @@ SECTIONS
 
 	.boot PHYS_OFFSET: {
 		*(.init)
-		*(.text* .data* .rodata* .bss* COMMON)
+		*(.text*)
+		*(.data* .rodata* .bss* COMMON)
 		*(.vectors)
 		*(.stack)
 		PROVIDE(etext = .);
-- 
2.11.0




More information about the linux-arm-kernel mailing list