We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello Community!
I have freshly built the new version from GCC (15.1.0) and binutils (2.44) for arm-none-eabi targets. Have tried to build U-Boot for STM32H743 (ARMv7-m), but running into an issue when linking U-Boot:
[...] LD u-boot arm-none-eabi-ld.bfd: warning: -z norelro ignored arm-none-eabi-ld.bfd: arch/arm/cpu/armv7m/start.o(c_runtime_cpu_setup): Unknown destination type (ARM/Thumb) in arch/arm/lib/crt0.o arch/arm/lib/crt0.o: in function `_main': /home/jk/Projects/U-Boot/src/arch/arm/lib/crt0.S:170:(.text+0x44): dangerous relocation: unsupported relocation make[1]: *** [/home/jk/Projects/U-Boot/src/Makefile:1824: u-boot] Error 1 make[1]: Leaving directory '/home/jk/Projects/U-Boot/build' make: *** [Makefile:177: sub-make] Error 2 $
By the way, with GCC 14.2.1 and binutils 2.43.1 the compilation is successful.
Has somebody noticed the same issue?
I have fixed the issue. Since binutils version 2.44 functions in assembly must include the assembler directive .type name, %function, otherwise they fail at linking.
This is described in a Git log from the binutils-gdb repository.
So in the source from U-Boot I added the missing and required .type c_runtime_cpu_setup, %function. under arch/arm/cpu/armv7m/start.S.
Thank you for coming back to share the solution you found with the community.
No problem.
For U-Boot I have released a patch to the U-Boot mailing list. It's reviewed by a maintainer, but currently not added into the official U-Boot Git repo.
Simple copy & paste from the patch (but removed the mail addresses):
Subject: [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros Since GNU binutils version 2.44, assembly functions must include the assembler directive .type name, %function. If not a call to these functions fails with the error message 'Unknown destination type (ARM/Thumb)' and the error message 'dangerous relocation: unsupported relocation' at linking. The macros ENTRY/ENDPROC includes this directive and should be used for all assembly functions. Signed-off-by: Johannes Krottmayer <MAILADDR-REMOVED> Cc: Tom Rini <MAILADDR-REMOVED> --- arch/arm/cpu/armv7m/start.S | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/arch/arm/cpu/armv7m/start.S b/arch/arm/cpu/armv7m/start.S index 0c07f2140c7..3355167b3b0 100644 --- a/arch/arm/cpu/armv7m/start.S +++ b/arch/arm/cpu/armv7m/start.S @@ -4,13 +4,19 @@ * Kamil Lulko, <MAILADDR-REMOVED> */ +#include <linux/linkage.h> #include <asm/assembler.h> -.globl reset -.type reset, %function -reset: - W(b) _main +/* + * Startup code (reset vector) + */ +ENTRY(reset) + W(b) _main @ Jump to _main (C runtime crt0.S) +ENDPROC(reset) -.globl c_runtime_cpu_setup -c_runtime_cpu_setup: - mov pc, lr +/* + * Setup CPU for C runtime + */ +ENTRY(c_runtime_cpu_setup) + mov pc, lr @ Jump back to caller +ENDPROC(c_runtime_cpu_setup)