* [PATCH 0/1] arm: add required assembler directive (binutils >=2.44)
@ 2025-05-07 6:07 Johannes Krottmayer
2025-05-07 6:07 ` [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive Johannes Krottmayer
0 siblings, 1 reply; 13+ messages in thread
From: Johannes Krottmayer @ 2025-05-07 6:07 UTC (permalink / raw)
To: u-boot; +Cc: Johannes Krottmayer, Tom Rini
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.
Johannes Krottmayer (1):
arm: cpu: armv7m: add required .type name, %function directive
arch/arm/cpu/armv7m/start.S | 1 +
1 file changed, 1 insertion(+)
--
2.39.5
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive
2025-05-07 6:07 [PATCH 0/1] arm: add required assembler directive (binutils >=2.44) Johannes Krottmayer
@ 2025-05-07 6:07 ` Johannes Krottmayer
2025-05-07 16:55 ` Tom Rini
0 siblings, 1 reply; 13+ messages in thread
From: Johannes Krottmayer @ 2025-05-07 6:07 UTC (permalink / raw)
To: u-boot; +Cc: Johannes Krottmayer, Tom Rini
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.
Signed-off-by: Johannes Krottmayer <johannes@krotti42.com>
Cc: Tom Rini <trini@konsulko.com>
---
arch/arm/cpu/armv7m/start.S | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/cpu/armv7m/start.S b/arch/arm/cpu/armv7m/start.S
index 0c07f2140c7..c20f01a0aed 100644
--- a/arch/arm/cpu/armv7m/start.S
+++ b/arch/arm/cpu/armv7m/start.S
@@ -12,5 +12,6 @@ reset:
W(b) _main
.globl c_runtime_cpu_setup
+.type c_runtime_cpu_setup, %function
c_runtime_cpu_setup:
mov pc, lr
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive
2025-05-07 6:07 ` [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive Johannes Krottmayer
@ 2025-05-07 16:55 ` Tom Rini
2025-05-07 18:17 ` Johannes Krottmayer
0 siblings, 1 reply; 13+ messages in thread
From: Tom Rini @ 2025-05-07 16:55 UTC (permalink / raw)
To: Johannes Krottmayer; +Cc: u-boot
[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]
On Wed, May 07, 2025 at 06:07:54AM +0000, Johannes Krottmayer wrote:
> 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.
>
> Signed-off-by: Johannes Krottmayer <johannes@krotti42.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> arch/arm/cpu/armv7m/start.S | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/cpu/armv7m/start.S b/arch/arm/cpu/armv7m/start.S
> index 0c07f2140c7..c20f01a0aed 100644
> --- a/arch/arm/cpu/armv7m/start.S
> +++ b/arch/arm/cpu/armv7m/start.S
> @@ -12,5 +12,6 @@ reset:
> W(b) _main
>
> .globl c_runtime_cpu_setup
> +.type c_runtime_cpu_setup, %function
> c_runtime_cpu_setup:
> mov pc, lr
Thanks for making the patch. There's an argument that this should use
the ENTRY / ENDPROC macros from <linux/linkage.h> but that also shows
that we're missing commit 5d4cae5fe2ea ("[ARM] VFP: fix section mismatch
error") from the kernel. And so I'm fine with making a TODO to clean
this up later if you don't want to embark on something a bit more
complicated here.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive
2025-05-07 16:55 ` Tom Rini
@ 2025-05-07 18:17 ` Johannes Krottmayer
2025-05-07 19:07 ` Johannes Krottmayer
0 siblings, 1 reply; 13+ messages in thread
From: Johannes Krottmayer @ 2025-05-07 18:17 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot
Hi Tom!
Thanks for the quick response!
On 5/7/25 18:55, Tom Rini wrote:
> On Wed, May 07, 2025 at 06:07:54AM +0000, Johannes Krottmayer wrote:
>
>> 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.
>>
>> Signed-off-by: Johannes Krottmayer <johannes@krotti42.com>
>> Cc: Tom Rini <trini@konsulko.com>
>> ---
>> arch/arm/cpu/armv7m/start.S | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm/cpu/armv7m/start.S b/arch/arm/cpu/armv7m/start.S
>> index 0c07f2140c7..c20f01a0aed 100644
>> --- a/arch/arm/cpu/armv7m/start.S
>> +++ b/arch/arm/cpu/armv7m/start.S
>> @@ -12,5 +12,6 @@ reset:
>> W(b) _main
>>
>> .globl c_runtime_cpu_setup
>> +.type c_runtime_cpu_setup, %function
>> c_runtime_cpu_setup:
>> mov pc, lr
>
> Thanks for making the patch. There's an argument that this should use
> the ENTRY / ENDPROC macros from <linux/linkage.h> but that also shows
> that we're missing commit 5d4cae5fe2ea ("[ARM] VFP: fix section mismatch
> error") from the kernel. And so I'm fine with making a TODO to clean
> this up later if you don't want to embark on something a bit more
> complicated here.
>
No problem for me to creating my simple patch. It's also not a problem
for me to use the required macros (ENTRY, ENDPROC). Use some similar
macros on my own projects too.
I have searched for your mentioned commit from Linux, and it's okay
when I try to add this too in further patches. For the correct
initialization from the floating point unit I must look more
precisely into the U-Boot and Linux source code.
But I have a question according the ENPROC macro:
include/linux/linkage.h (from U-Boot):
#ifndef ENDPROC
#define ENDPROC(name) \
.type name STT_FUNC ASM_NL \
END(name)
#endif
Especially the macro/define STT_FUNC. I have thought STT_FUNC is
%function, but haven't found these in the current U-Boot master
branch.
Simple search with grep on the shell:
"
jk@workstation:~/Projects/U-Boot/src> grep -R STT_FUNC
include/linux/linkage.h: .type name STT_FUNC ASM_NL \
include/elf.h:#define STT_FUNC 2 /* function */
jk@workstation:~/Projects/U-Boot/src>
"
Also tried a much more comfortable search with the elixir.bootlin
identifier search. As you can see STT_FUNC is defined only in the
ELF header. 'include/linux/linkage.h' doesn't include the ELF
header. And I don't know if the value 2 for STT_FUNC is an alternative
usage from the .type directive. 'include/linux/linkage.h' includes
'asm/linkage.h'. I'm still a newbie with the U-Boot build process
and I think on build the machine dependent header will included
(arch/arm/include/linkage.h). Correct me if I'm wrong please.
Also there will be elf.h not included.
Maybe the STT_FUNC will defined in build process, but shouldn't
I find this in a specific Makefile with a simple search with grep?
By the I could change STT_FUNC to %function, but I didn't know
(not tried yet) if this has other bad effects.
Thanks in advance!
Kind regards,
Johannes
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive
2025-05-07 18:17 ` Johannes Krottmayer
@ 2025-05-07 19:07 ` Johannes Krottmayer
2025-05-07 21:18 ` Johannes Krottmayer
2025-05-07 22:51 ` Tom Rini
0 siblings, 2 replies; 13+ messages in thread
From: Johannes Krottmayer @ 2025-05-07 19:07 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot
Hi Tom!
Okay, STT_FUNC is an alternative spelling for %function, didn't
know that before. So my question is deprecated.
Sorry, for wasting your time.
BTW, I will add the required macros and also try to add the VFP
support. But I think it's better in two different patches. First
patch with the ENTRY/ENDPROC macros and later with the VFP patch.
On 5/7/25 20:17, Johannes Krottmayer wrote:
> Hi Tom!
>
> Thanks for the quick response!
>
> On 5/7/25 18:55, Tom Rini wrote:
>> On Wed, May 07, 2025 at 06:07:54AM +0000, Johannes Krottmayer wrote:
>>
>>> 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.
>>>
>>> Signed-off-by: Johannes Krottmayer <johannes@krotti42.com>
>>> Cc: Tom Rini <trini@konsulko.com>
>>> ---
>>> arch/arm/cpu/armv7m/start.S | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/arch/arm/cpu/armv7m/start.S b/arch/arm/cpu/armv7m/start.S
>>> index 0c07f2140c7..c20f01a0aed 100644
>>> --- a/arch/arm/cpu/armv7m/start.S
>>> +++ b/arch/arm/cpu/armv7m/start.S
>>> @@ -12,5 +12,6 @@ reset:
>>> W(b) _main
>>>
>>> .globl c_runtime_cpu_setup
>>> +.type c_runtime_cpu_setup, %function
>>> c_runtime_cpu_setup:
>>> mov pc, lr
>>
>> Thanks for making the patch. There's an argument that this should use
>> the ENTRY / ENDPROC macros from <linux/linkage.h> but that also shows
>> that we're missing commit 5d4cae5fe2ea ("[ARM] VFP: fix section mismatch
>> error") from the kernel. And so I'm fine with making a TODO to clean
>> this up later if you don't want to embark on something a bit more
>> complicated here.
>>
>
> No problem for me to creating my simple patch. It's also not a problem
> for me to use the required macros (ENTRY, ENDPROC). Use some similar
> macros on my own projects too.
>
> I have searched for your mentioned commit from Linux, and it's okay
> when I try to add this too in further patches. For the correct
> initialization from the floating point unit I must look more
> precisely into the U-Boot and Linux source code.
>
> But I have a question according the ENPROC macro:
>
> include/linux/linkage.h (from U-Boot):
> #ifndef ENDPROC
> #define ENDPROC(name) \
> .type name STT_FUNC ASM_NL \
> END(name)
> #endif
>
> Especially the macro/define STT_FUNC. I have thought STT_FUNC is
> %function, but haven't found these in the current U-Boot master
> branch.
>
> Simple search with grep on the shell:
> "
> jk@workstation:~/Projects/U-Boot/src> grep -R STT_FUNC
> include/linux/linkage.h: .type name STT_FUNC ASM_NL \
> include/elf.h:#define STT_FUNC 2 /* function */
> jk@workstation:~/Projects/U-Boot/src>
> "
>
> Also tried a much more comfortable search with the elixir.bootlin
> identifier search. As you can see STT_FUNC is defined only in the
> ELF header. 'include/linux/linkage.h' doesn't include the ELF
> header. And I don't know if the value 2 for STT_FUNC is an alternative
> usage from the .type directive. 'include/linux/linkage.h' includes
> 'asm/linkage.h'. I'm still a newbie with the U-Boot build process
> and I think on build the machine dependent header will included
> (arch/arm/include/linkage.h). Correct me if I'm wrong please.
> Also there will be elf.h not included.
>
> Maybe the STT_FUNC will defined in build process, but shouldn't
> I find this in a specific Makefile with a simple search with grep?
>
> By the I could change STT_FUNC to %function, but I didn't know
> (not tried yet) if this has other bad effects.
>
> Thanks in advance!
>
> Kind regards,
>
> Johannes
>
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive
2025-05-07 19:07 ` Johannes Krottmayer
@ 2025-05-07 21:18 ` Johannes Krottmayer
2025-05-07 22:51 ` Tom Rini
1 sibling, 0 replies; 13+ messages in thread
From: Johannes Krottmayer @ 2025-05-07 21:18 UTC (permalink / raw)
To: Tom Rini, patrick.delaunay, patrice.chotard; +Cc: u-boot
Hello Tom, Patrick and Patrice!
For the ARMv7-M architecture depended code and for the boards as
example from STMicroelectronics:
There are a few missing but 'maybe' required initialization steps
which I haven't seen yet in the U-Boot code:
1) AHB (Advanced High-performance Bus)
According the TRM from the ARMv7-M architecture, this peripheral
bus should be enabled in the startup code.
2) ITCM/DTCM Tightly Coupled Memory (Instruction/Data)
Some ARMv7-M includes this memory type and should also be enabled
in the startup code.
3) Low-level init (currently not implemented)
STMicroelectronis SoC's need a low-level initialization for
the AXI-SRAM. To use this RAM type, there must be a few steps
done into the PWR (power) register from the SoC. If not
the SoC runs in limited mode (Run*) and write/reads to this
RAM might be corrupted. If U-Boot use this RAM for itself
then this step should be done before any stack usage.
I hope Patrick or Patrice can clarify that. Could also be possible
that I have misunderstood the ST TRM's.
4) Doesn't U-Boot use an ICache and DCache for itself?
Invalidation also missing in the startup code. I have seen the
ICache/DCache will disabled before Linux, but currently I
didn't seen if U-Boot use also the caches.
On 5/7/25 21:07, Johannes Krottmayer wrote:
> Hi Tom!
>
> Okay, STT_FUNC is an alternative spelling for %function, didn't
> know that before. So my question is deprecated.
>
> Sorry, for wasting your time.
>
> BTW, I will add the required macros and also try to add the VFP
> support. But I think it's better in two different patches. First
> patch with the ENTRY/ENDPROC macros and later with the VFP patch.
>
> On 5/7/25 20:17, Johannes Krottmayer wrote:
>> Hi Tom!
>>
>> Thanks for the quick response!
>>
>> On 5/7/25 18:55, Tom Rini wrote:
>>> On Wed, May 07, 2025 at 06:07:54AM +0000, Johannes Krottmayer wrote:
>>>
>>>> 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.
>>>>
>>>> Signed-off-by: Johannes Krottmayer <johannes@krotti42.com>
>>>> Cc: Tom Rini <trini@konsulko.com>
>>>> ---
>>>> arch/arm/cpu/armv7m/start.S | 1 +
>>>> 1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/arch/arm/cpu/armv7m/start.S b/arch/arm/cpu/armv7m/start.S
>>>> index 0c07f2140c7..c20f01a0aed 100644
>>>> --- a/arch/arm/cpu/armv7m/start.S
>>>> +++ b/arch/arm/cpu/armv7m/start.S
>>>> @@ -12,5 +12,6 @@ reset:
>>>> W(b) _main
>>>>
>>>> .globl c_runtime_cpu_setup
>>>> +.type c_runtime_cpu_setup, %function
>>>> c_runtime_cpu_setup:
>>>> mov pc, lr
>>>
>>> Thanks for making the patch. There's an argument that this should use
>>> the ENTRY / ENDPROC macros from <linux/linkage.h> but that also shows
>>> that we're missing commit 5d4cae5fe2ea ("[ARM] VFP: fix section mismatch
>>> error") from the kernel. And so I'm fine with making a TODO to clean
>>> this up later if you don't want to embark on something a bit more
>>> complicated here.
>>>
>>
>> No problem for me to creating my simple patch. It's also not a problem
>> for me to use the required macros (ENTRY, ENDPROC). Use some similar
>> macros on my own projects too.
>>
>> I have searched for your mentioned commit from Linux, and it's okay
>> when I try to add this too in further patches. For the correct
>> initialization from the floating point unit I must look more
>> precisely into the U-Boot and Linux source code.
>>
>> But I have a question according the ENPROC macro:
>>
>> include/linux/linkage.h (from U-Boot):
>> #ifndef ENDPROC
>> #define ENDPROC(name) \
>> .type name STT_FUNC ASM_NL \
>> END(name)
>> #endif
>>
>> Especially the macro/define STT_FUNC. I have thought STT_FUNC is
>> %function, but haven't found these in the current U-Boot master
>> branch.
>>
>> Simple search with grep on the shell:
>> "
>> jk@workstation:~/Projects/U-Boot/src> grep -R STT_FUNC
>> include/linux/linkage.h: .type name STT_FUNC ASM_NL \
>> include/elf.h:#define STT_FUNC 2 /* function */
>> jk@workstation:~/Projects/U-Boot/src>
>> "
>>
>> Also tried a much more comfortable search with the elixir.bootlin
>> identifier search. As you can see STT_FUNC is defined only in the
>> ELF header. 'include/linux/linkage.h' doesn't include the ELF
>> header. And I don't know if the value 2 for STT_FUNC is an alternative
>> usage from the .type directive. 'include/linux/linkage.h' includes
>> 'asm/linkage.h'. I'm still a newbie with the U-Boot build process
>> and I think on build the machine dependent header will included
>> (arch/arm/include/linkage.h). Correct me if I'm wrong please.
>> Also there will be elf.h not included.
>>
>> Maybe the STT_FUNC will defined in build process, but shouldn't
>> I find this in a specific Makefile with a simple search with grep?
>>
>> By the I could change STT_FUNC to %function, but I didn't know
>> (not tried yet) if this has other bad effects.
>>
>> Thanks in advance!
>>
>> Kind regards,
>>
>> Johannes
>>
>>
>>
>>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive
2025-05-07 19:07 ` Johannes Krottmayer
2025-05-07 21:18 ` Johannes Krottmayer
@ 2025-05-07 22:51 ` Tom Rini
2025-05-07 23:36 ` Johannes Krottmayer
2025-05-08 19:00 ` [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros Johannes Krottmayer
1 sibling, 2 replies; 13+ messages in thread
From: Tom Rini @ 2025-05-07 22:51 UTC (permalink / raw)
To: Johannes Krottmayer; +Cc: u-boot
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
On Wed, May 07, 2025 at 07:07:03PM +0000, Johannes Krottmayer wrote:
> Hi Tom!
>
> Okay, STT_FUNC is an alternative spelling for %function, didn't
> know that before. So my question is deprecated.
>
> Sorry, for wasting your time.
>
> BTW, I will add the required macros and also try to add the VFP
> support. But I think it's better in two different patches. First
> patch with the ENTRY/ENDPROC macros and later with the VFP patch.
Ah, thanks. I too didn't know about STT_FUNC until now. So I think that
means all we really need then is to use ENTRY/ENDPROC on that function?
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive
2025-05-07 22:51 ` Tom Rini
@ 2025-05-07 23:36 ` Johannes Krottmayer
2025-05-08 19:00 ` [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros Johannes Krottmayer
1 sibling, 0 replies; 13+ messages in thread
From: Johannes Krottmayer @ 2025-05-07 23:36 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot
Hi Tom!
On 5/8/25 00:51, Tom Rini wrote:
> On Wed, May 07, 2025 at 07:07:03PM +0000, Johannes Krottmayer wrote:
>> Hi Tom!
>>
>> Okay, STT_FUNC is an alternative spelling for %function, didn't
>> know that before. So my question is deprecated.
>>
>> Sorry, for wasting your time.
>>
>> BTW, I will add the required macros and also try to add the VFP
>> support. But I think it's better in two different patches. First
>> patch with the ENTRY/ENDPROC macros and later with the VFP patch.
>
> Ah, thanks. I too didn't know about STT_FUNC until now. So I think that
> means all we really need then is to use ENTRY/ENDPROC on that function?
>
I have added the required macros, also for the 'reset' function.
There were also the .globl and .type directive used.
Additional I added some comments, if they are not needed I can
remove them.
Also have changed in 'c_runtime_cpu_setup' the code 'mov pc, lr'
to 'bx lr', because I think for newer programmers this is sometimes
misleading. Also for me at the beginning on ARM in the past.
Here is the full code for start.S, which I have modified:
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* (C) Copyright 2015
* Kamil Lulko, <kamil.lulko@gmail.com>
*/
#include <linux/linkage.h>
#include <asm/assembler.h>
/*
* Startup code (reset vector)
*/
ENTRY(reset)
W(b) _main @ Jump to _main (C runtime crt0.S)
ENDPROC(reset)
/*
* Setup CPU for C runtime
*/
ENTRY(c_runtime_cpu_setup)
bx lr @ Jump back to caller
ENDPROC(c_runtime_cpu_setup)
If this is okay for you, I will release a patch v2 for it. if not,
(coding style, ...) then please tell me that.
Kind regards,
Johannes
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros
2025-05-07 22:51 ` Tom Rini
2025-05-07 23:36 ` Johannes Krottmayer
@ 2025-05-08 19:00 ` Johannes Krottmayer
2025-05-08 19:09 ` Johannes Krottmayer
` (2 more replies)
1 sibling, 3 replies; 13+ messages in thread
From: Johannes Krottmayer @ 2025-05-08 19:00 UTC (permalink / raw)
To: u-boot; +Cc: Johannes Krottmayer, Tom Rini
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@krotti42.com>
Cc: Tom Rini <trini@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@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
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros
2025-05-08 19:00 ` [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros Johannes Krottmayer
@ 2025-05-08 19:09 ` Johannes Krottmayer
2025-05-08 19:34 ` Tom Rini
2025-05-08 19:33 ` Tom Rini
2025-05-22 19:36 ` Tom Rini
2 siblings, 1 reply; 13+ messages in thread
From: Johannes Krottmayer @ 2025-05-08 19:09 UTC (permalink / raw)
To: u-boot; +Cc: Tom Rini
Hi Tom!
I have tested the patch on real hardware and it works. But have
must add an additional board which is currently not in the U-Boot
tree from STMicroelectronis. Maybe I will release a patch series
too.
On 5/8/25 21:00, Johannes Krottmayer wrote:
> 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@krotti42.com>
> Cc: Tom Rini <trini@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@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)
Kind regards,
Johannes
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros
2025-05-08 19:00 ` [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros Johannes Krottmayer
2025-05-08 19:09 ` Johannes Krottmayer
@ 2025-05-08 19:33 ` Tom Rini
2025-05-22 19:36 ` Tom Rini
2 siblings, 0 replies; 13+ messages in thread
From: Tom Rini @ 2025-05-08 19:33 UTC (permalink / raw)
To: Johannes Krottmayer; +Cc: u-boot
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]
On Thu, May 08, 2025 at 07:00:28PM +0000, Johannes Krottmayer wrote:
> 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@krotti42.com>
> Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros
2025-05-08 19:09 ` Johannes Krottmayer
@ 2025-05-08 19:34 ` Tom Rini
0 siblings, 0 replies; 13+ messages in thread
From: Tom Rini @ 2025-05-08 19:34 UTC (permalink / raw)
To: Johannes Krottmayer; +Cc: u-boot
[-- Attachment #1: Type: text/plain, Size: 326 bytes --]
On Thu, May 08, 2025 at 07:09:33PM +0000, Johannes Krottmayer wrote:
> Hi Tom!
>
> I have tested the patch on real hardware and it works. But have
> must add an additional board which is currently not in the U-Boot
> tree from STMicroelectronis. Maybe I will release a patch series
> too.
OK, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros
2025-05-08 19:00 ` [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros Johannes Krottmayer
2025-05-08 19:09 ` Johannes Krottmayer
2025-05-08 19:33 ` Tom Rini
@ 2025-05-22 19:36 ` Tom Rini
2 siblings, 0 replies; 13+ messages in thread
From: Tom Rini @ 2025-05-22 19:36 UTC (permalink / raw)
To: u-boot, Johannes Krottmayer
On Thu, 08 May 2025 19:00:28 +0000, Johannes Krottmayer wrote:
> 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.
>
> [...]
Applied to u-boot/next, thanks!
[1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros
commit: 0a006371578a8f098c1850b0097c1af68c018165
--
Tom
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-05-22 19:36 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-07 6:07 [PATCH 0/1] arm: add required assembler directive (binutils >=2.44) Johannes Krottmayer
2025-05-07 6:07 ` [PATCH 1/1] arm: cpu: armv7m: add required .type name, %function directive Johannes Krottmayer
2025-05-07 16:55 ` Tom Rini
2025-05-07 18:17 ` Johannes Krottmayer
2025-05-07 19:07 ` Johannes Krottmayer
2025-05-07 21:18 ` Johannes Krottmayer
2025-05-07 22:51 ` Tom Rini
2025-05-07 23:36 ` Johannes Krottmayer
2025-05-08 19:00 ` [PATCH v2 1/1] arm: cpu: armv7m: add ENTRY/ENDPROC macros Johannes Krottmayer
2025-05-08 19:09 ` Johannes Krottmayer
2025-05-08 19:34 ` Tom Rini
2025-05-08 19:33 ` Tom Rini
2025-05-22 19:36 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.