aboutsummaryrefslogtreecommitdiffstats
path: root/meta-arm-bsp/recipes-bsp/boot-wrapper-aarch64/files/fvp-baser-aemv8r64/0019-lds-Rearrange-and-mark-the-sections.patch
blob: 1f10209da198eeb4b1982a20b34de30f54d80d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 36b5fa3f4db49ac7aef42ff1d58a895226c7e96c Mon Sep 17 00:00:00 2001
From: Jaxson Han <jaxson.han@arm.com>
Date: Tue, 2 Nov 2021 15:10:28 +0800
Subject: [PATCH] lds: Rearrange and mark the sections

To make it possible for the next stage to protect sections with MPU,
boot-wrapper needs to provide the text and data section information.
By rearranging the .data .rodata and .vector sections, all sections
can be split into 2 big sections:
 - RO and Executable
 - RW and Non-Executable
Add firmware_data to mark the boundry, thus:
firmware_start to firmware_data - 1 indicates RO and Executable section,
firmware_data to firmware_end - 1 indicates RW and Non-Executable
section.

Also, the firmware_data and firmware_end should align with 64 bytes,
since Armv8R AArch64 MPU requires it.

Issue-ID: SCM-3816
Upstream-Status: Inappropriate [other]
  Implementation pending further discussion
Signed-off-by: Jaxson Han <jaxson.han@arm.com>
Change-Id: I55342aa7492f2c7b5c16ab9a6472c8cb45cff8fd
---
 model.lds.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/model.lds.S b/model.lds.S
index ab98ddf..85451f9 100644
--- a/model.lds.S
+++ b/model.lds.S
@@ -63,12 +63,16 @@ SECTIONS
 	}
 #endif
 
+#define FIRMWARE_ALIGN . = ALIGN(1 << 6)
 	.boot PHYS_OFFSET: {
 		PROVIDE(firmware_start = .);
 		*(.init)
 		*(.text*)
-		*(.data* .rodata* .bss* COMMON)
 		*(.vectors)
+		*(.rodata*)
+		FIRMWARE_ALIGN;
+		PROVIDE(firmware_data = .);
+		*(.data* .bss* COMMON)
 		*(.stack)
 		PROVIDE(etext = .);
 	}
@@ -77,6 +81,7 @@ SECTIONS
 		mbox = .;
 		QUAD(0x0)
 	}
+	FIRMWARE_ALIGN;
 	PROVIDE(firmware_end = .);
 
 	ASSERT(etext <= (PHYS_OFFSET + TEXT_LIMIT), ".text overflow!")
-- 
2.25.1