[PATCH] examples: fix building on arm32

From: Liya Huang 1425075683@qq.com
Refer to the commit a3c101a61348 ("examples: fix building on arm64") fix for arm32. crt0.S does not even build with CONFIG_API=y, CONFIG_EXAMPLES=y:
examples/api/crt0.S: Assembler messages: examples/api/crt0.S:32: Error: lo register required -- `ldr ip,=search_hint' examples/api/crt0.S:33: Error: lo register required -- `str sp,[ip]' examples/api/crt0.S:39: Error: lo register required -- `ldr ip,=syscall_ptr' examples/api/crt0.S:40: Error: lo register required -- `ldr pc,[ip]' make[2]: *** [scripts/Makefile.build:292:examples/api/crt0.o] Error 1
Use valid register names and instructions.
Signed-off-by: Liya Huang 1425075683@qq.com ---
examples/api/crt0.S | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/examples/api/crt0.S b/examples/api/crt0.S index d2a97557817..d33e1c4aa4d 100644 --- a/examples/api/crt0.S +++ b/examples/api/crt0.S @@ -29,15 +29,17 @@ syscall: .text .globl _start _start: - ldr ip, =search_hint - str sp, [ip] + ldr r0, =search_hint + mov r1, sp + str r1, [r0] b main
.globl syscall syscall: - ldr ip, =syscall_ptr - ldr pc, [ip] + ldr r0, =syscall_ptr + ldr r0, [r0] + bx r0
#elif defined(CONFIG_ARM64)

On 1/27/25 05:15, 1425075683@qq.com wrote:
From: Liya Huang 1425075683@qq.com
Refer to the commit a3c101a61348 ("examples: fix building on arm64") fix for arm32. crt0.S does not even build with CONFIG_API=y, CONFIG_EXAMPLES=y:
examples/api/crt0.S: Assembler messages: examples/api/crt0.S:32: Error: lo register required -- `ldr ip,=search_hint' examples/api/crt0.S:33: Error: lo register required -- `str sp,[ip]' examples/api/crt0.S:39: Error: lo register required -- `ldr ip,=syscall_ptr' examples/api/crt0.S:40: Error: lo register required -- `ldr pc,[ip]' make[2]: *** [scripts/Makefile.build:292:examples/api/crt0.o] Error 1
Use valid register names and instructions.
Hello Liva,
Thank you for reporting the issue that you experience and suggesting a patch.
I am not able to reproduce your problem using
make qemu_arm_defconfig make menuconfig # to add CONFIG_API=y, CONFIG_EXAMPLES=y export CROSS_COMPILE=arm-linux-gnueabi- make
https://developer.arm.com/documentation/den0013/d/Application-Binary-Interfa... lists IP, SP, PC as aliases for registers R12, R13, R15.
I am using gcc 4.2.0 and binutils 2.43 on Ubuntu 25.04.
Could you, please, share some detail on how to reproduce your issue:
* version of U-Boot (commit in git) * operating system and architecture * installed version of gcc and binutils * used defconfig * used commands for building
Best regards
Heinrich
Signed-off-by: Liya Huang 1425075683@qq.com
examples/api/crt0.S | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/examples/api/crt0.S b/examples/api/crt0.S index d2a97557817..d33e1c4aa4d 100644 --- a/examples/api/crt0.S +++ b/examples/api/crt0.S @@ -29,15 +29,17 @@ syscall: .text .globl _start _start:
- ldr ip, =search_hint
- str sp, [ip]
ldr r0, =search_hint
mov r1, sp
str r1, [r0] b main
.globl syscall syscall:
- ldr ip, =syscall_ptr
- ldr pc, [ip]
ldr r0, =syscall_ptr
ldr r0, [r0]
bx r0
#elif defined(CONFIG_ARM64)
participants (2)
-
1425075683@qq.com
-
Heinrich Schuchardt