[PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros

Johannes Krottmayer johannes at krotti42.com
Thu May 8 21:00:28 CEST 2025


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 <johannes at krotti42.com>
Cc: Tom Rini <trini at konsulko.com>
---
 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, <kamil.lulko at gmail.com>
  */
 
+#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)
-- 
2.39.5




More information about the U-Boot mailing list