Skip to contentSkip to conversation

ARM - Linking issue with binutils 2.44 (dangerous relocation: unsupported relocation)

DISCUSSION Johannes Krottmayer 2 participants 2 messages May 4, 2025 – May 5, 2025

lore
Share & tools
lore
#0 lore raw

Hello U-Boot list members!

There exist an issue with the newly GNU binutils version 2.44 when trying to build U-Boot at link time.

Error output:

$ make stm32h743-eval_defconfig
$ make
[...]
   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
$

I have tried to fixed it with success. Simply added the assembler directive ".type c_runtime_cpu_setup, %function" after ".globl c_runtime_cpu_setup". under the path:

arch/arm/cpu/armv7m/start.S

The binutils patch with cause this building error is explained at least in the following commit in the binutils git repo:
31ed3a9d691493486f6e32357d89a55229dbdc0a

Extract from the log:

"This patch emits an error instead, and warns in some other cases, to encourage users to add the missing '.type foo,%function' directive."

But I don't know if this only exist on ARMv7-M.

Kind regards,

Johannes

#1 lore raw
Quoted 31 lines · Johannes Krottmayer

Hello U-Boot list members!

There exist an issue with the newly GNU binutils version 2.44 when trying to build U-Boot at link time.

Error output:

$ make stm32h743-eval_defconfig
$ make
[...]
   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
$

I have tried to fixed it with success. Simply added the assembler directive ".type c_runtime_cpu_setup, %function" after ".globl c_runtime_cpu_setup". under the path:

arch/arm/cpu/armv7m/start.S

The binutils patch with cause this building error is explained at least in the following commit in the binutils git repo:
31ed3a9d691493486f6e32357d89a55229dbdc0a

Quoted 7 lines

Extract from the log:

"This patch emits an error instead, and warns in some other cases, to encourage users to add the missing '.type foo,%function' directive."

But I don't know if this only exist on ARMv7-M.

Thanks for the report. Would you mind submitting a patch to at least fix that case? It'll help in the future with other reports.

Signature · 1 line
Tom