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
|
From 687c229fb85f1116eef2a103617e44dd0bca0953 Mon Sep 17 00:00:00 2001
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
Date: Fri, 22 Apr 2022 14:47:53 +0200
Subject: [PATCH 1/5] ARM: asm: fix miscompilation of 32-bit
ENTRY_FUNCTION_WITHSTACK
gcc-11.1.1 shipped with OSELAS.Toolchain-2021.07.0 hoists a single
instruction from __ARM_SETUP_STACK in front of __barebox_arm_head
breaking the barebox header format for the Raspberry Pi 3. This can't
happen with ARM64 and the Raspberry Pi entry points are currently the
only 32-bit users.
While the resulting barebox image was still bootable, header detection
would fail. Add an intermediate naked function to work around this.
This is not required for plain ENTRY_FUNCTION, because the
board-supplied entry point is already NAKED. For
ENTRY_FUNCTION_WITH_FUNCTION, that same entry point is intentionally
non-naked to reduce pitfalls for board code authors..
Fixes: 880c9803b95a ("ARM: implement ENTRY_FUNCTION_WITHSTACK")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/include/asm/barebox-arm.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index d915cde294a4..8b0c00633277 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -194,15 +194,21 @@ static inline unsigned long arm_mem_barebox_image(unsigned long membase,
void name(ulong r0, ulong r1, ulong r2); \
\
static void __##name(ulong, ulong, ulong); \
+ static void ____##name(ulong, ulong, ulong); \
\
void NAKED __section(.text_head_entry_##name) name \
(ulong r0, ulong r1, ulong r2) \
{ \
__barebox_arm_head(); \
- __ARM_SETUP_STACK(stack_top); \
__##name(r0, r1, r2); \
} \
- static void noinline __##name \
+ static void NAKED noinline __##name \
+ (ulong r0, ulong r1, ulong r2) \
+ { \
+ __ARM_SETUP_STACK(stack_top); \
+ ____##name(r0, r1, r2); \
+ } \
+ static void noinline ____##name \
(ulong arg0, ulong arg1, ulong arg2)
--
2.30.2
|