[Skiboot] [PATCH 3/4] skiboot.lds.S: move read-write data after the end of symbol map

Nicholas Piggin npiggin at gmail.com
Tue Sep 18 15:49:52 AEST 2018


This also tidies up linker script symbol declarations and adds
_rodata_mem symbol for the next change to use.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/stack.c      |  2 --
 include/skiboot.h |  7 +++++++
 skiboot.lds.S     | 41 ++++++++++++++++++++++++-----------------
 3 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/core/stack.c b/core/stack.c
index 73700ce5..3a86a376 100644
--- a/core/stack.c
+++ b/core/stack.c
@@ -26,8 +26,6 @@
 #define STACK_BUF_ENTRIES	60
 static struct bt_entry bt_buf[STACK_BUF_ENTRIES];
 
-extern uint32_t _stext, _etext;
-
 /* Dumps backtrace to buffer */
 void __nomcount ___backtrace(struct bt_entry *entries, unsigned int *count,
 				unsigned long r1,
diff --git a/include/skiboot.h b/include/skiboot.h
index bba76c12..6b4d7771 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -48,6 +48,13 @@
 struct mem_region;
 extern struct mem_region *mem_region_next(struct mem_region *region);
 
+/* Misc linker script symbols */
+extern char _start[];
+extern char _stext[];
+extern char _etext[];
+extern char __sym_map_end[];
+extern char _romem_end[];
+
 #ifndef __TESTING__
 /* Readonly section start and end. */
 extern char __rodata_start[], __rodata_end[];
diff --git a/skiboot.lds.S b/skiboot.lds.S
index a6e71077..8fae2084 100644
--- a/skiboot.lds.S
+++ b/skiboot.lds.S
@@ -20,6 +20,7 @@
 ENTRY(boot_entry);
 SECTIONS
 {
+	_start = .;
 	. = 0;
 
 	.head : {
@@ -65,23 +66,6 @@ SECTIONS
 		__rodata_end = .;
 	}
 
-	.data : {
-		/*
-		 * A couple of things that need to be 4K aligned and
-		 * to reside in their own pages for the sake of TCE
-		 * mappings
-		 */
-		. = ALIGN(0x1000);
-		*(.data.memcons);
-		. = ALIGN(0x1000);
-		*(.data.boot_trace);
-		. = ALIGN(0x1000);
-		*(.data*)
-		*(.force.data)
-		*(.toc1)
-		*(.branch_lt)
-	}
-
 	. = ALIGN(0x10);
 	.init : {
 		__ctors_start = .;
@@ -146,6 +130,29 @@ SECTIONS
 		__sym_map_end = . ;
 	}
 
+	/*
+	 * Memory above this point should be un-changing after the OS
+	 * boots, and is verified with a checksum upon fast reboot.
+	 */
+	_romem_end = .;
+
+	.data : {
+		/*
+		 * A couple of things that need to be 4K aligned and
+		 * to reside in their own pages for the sake of TCE
+		 * mappings
+		 */
+		. = ALIGN(0x1000);
+		*(.data.memcons);
+		. = ALIGN(0x1000);
+		*(.data.boot_trace);
+		. = ALIGN(0x1000);
+		*(.data*)
+		*(.force.data)
+		*(.toc1)
+		*(.branch_lt)
+	}
+
 	/* We locate the BSS at 3M to leave room for the symbol map */
 	. = 0x300000;
 
-- 
2.18.0



More information about the Skiboot mailing list