summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/pbl.lds.S
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-10-24 08:57:13 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-10-26 06:21:43 +0200
commit2d68037eb90ad8dab6402da04c7fc66f798b159f (patch)
tree11cd9d85e5cde81266c21b0694427d3588a3cfbe /arch/arm/lib/pbl.lds.S
parenteee1b8846b0788c866dabf04e85742a48662455f (diff)
downloadbarebox-2d68037eb90ad8dab6402da04c7fc66f798b159f.tar.gz
barebox-2d68037eb90ad8dab6402da04c7fc66f798b159f.tar.xz
ARM64: asm: rewrite ENTRY_FUNCTION(_WITHSTACK) fully in assembly
Recent episode with pointer authentication showed again that for platforms without __attribute__((naked)), we are better off writing the early header in assembly. We still want to keep the board specific entry points in C for ease of use, so we have ENTRY_FUNCTION_WITHSTACK generate two symbols: - A 32-bit stack top value that's placed in .rodata - An entry point with the normal C code, including stack-using prologues The new common assembly head code will access the stack pointer in a position-independent manner and set it up, before continuing with the C code. The barebox header is part of the common assembly head code ensuring it's not moved around due to compiler code generation. The common code will need access to board-specific entry point and stack top. The former is readily available as the alias __pbl_board_entry. The latter is a bit more complicated, as the symbol may not exist for boards not using the common header in a multi-image build. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221024065716.1215046-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib/pbl.lds.S')
-rw-r--r--arch/arm/lib/pbl.lds.S9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
index ae1babdcfd..114ec7bc81 100644
--- a/arch/arm/lib/pbl.lds.S
+++ b/arch/arm/lib/pbl.lds.S
@@ -44,6 +44,15 @@ SECTIONS
. = ALIGN(4);
.rodata : { *(.rodata*) }
+ . = ALIGN(4);
+ __pbl_board_stack_top = .;
+ .rodata.pbl_board_stack_top : {
+ *(.pbl_board_stack_top_*)
+ /* Dummy for when BootROM sets up usable stack */
+ LONG(0x00000000);
+ }
+ ASSERT(. - __pbl_board_stack_top <= 8, "Only One PBL per Image allowed")
+
.barebox_imd : { BAREBOX_IMD }
_etext = .; /* End of text and rodata section */