diff mbox series

arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360]

Message ID 741d8c16-702c-45cd-ba73-a7c8fc4869e2@arm.com
State New
Headers show
Series arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360] | expand

Commit Message

Andre Vieira (lists) June 5, 2024, 4:07 p.m. UTC
Hi,

This patch adds missing assembly directives to the CMSE library wrapper 
to call functions with attribute cmse_nonsecure_call.  Without the .type 
directive the linker will fail to produce the correct veneer if a call 
to this wrapper function is to far from the wrapper itself.  The .size 
was added for completeness, though we don't necessarily have a usecase 
for it.

I did not add a testcase as I couldn't get dejagnu to disassemble the 
linked binary to check we used an appropriate branch instruction, I did 
however test it locally and with this change the GNU linker now 
generates an appropriate veneer and call to that veneer when 
__gnu_cmse_nonsecure_call is too far.

OK for trunk and backport to any release branches still in support 
(after waiting a week or so)?

libgcc/ChangeLog:

	PR target/115360
	* config/arm/cmse_nonsecure_call.S: Add .type and .size directives.

Comments

Richard Earnshaw (lists) June 6, 2024, 11:53 a.m. UTC | #1
On 05/06/2024 17:07, Andre Vieira (lists) wrote:
> Hi,
> 
> This patch adds missing assembly directives to the CMSE library wrapper to call functions with attribute cmse_nonsecure_call.  Without the .type directive the linker will fail to produce the correct veneer if a call to this wrapper function is to far from the wrapper itself.  The .size was added for completeness, though we don't necessarily have a usecase for it.
> 
> I did not add a testcase as I couldn't get dejagnu to disassemble the linked binary to check we used an appropriate branch instruction, I did however test it locally and with this change the GNU linker now generates an appropriate veneer and call to that veneer when __gnu_cmse_nonsecure_call is too far.
> 
> OK for trunk and backport to any release branches still in support (after waiting a week or so)?
> 
> libgcc/ChangeLog:
> 
>     PR target/115360
>     * config/arm/cmse_nonsecure_call.S: Add .type and .size directives.

OK.

R.
Andre Vieira (lists) June 12, 2024, 8:53 a.m. UTC | #2
On 06/06/2024 12:53, Richard Earnshaw (lists) wrote:
> On 05/06/2024 17:07, Andre Vieira (lists) wrote:
>> Hi,
>>
>> This patch adds missing assembly directives to the CMSE library wrapper to call functions with attribute cmse_nonsecure_call.  Without the .type directive the linker will fail to produce the correct veneer if a call to this wrapper function is to far from the wrapper itself.  The .size was added for completeness, though we don't necessarily have a usecase for it.
>>
>> I did not add a testcase as I couldn't get dejagnu to disassemble the linked binary to check we used an appropriate branch instruction, I did however test it locally and with this change the GNU linker now generates an appropriate veneer and call to that veneer when __gnu_cmse_nonsecure_call is too far.
>>
>> OK for trunk and backport to any release branches still in support (after waiting a week or so)?
>>
>> libgcc/ChangeLog:
>>
>>      PR target/115360
>>      * config/arm/cmse_nonsecure_call.S: Add .type and .size directives.
> 
> OK.
> 
> R.

OK to backport? I was thinking backporting it as far as gcc-11 (we 
haven't done a 11.5 yet).

Kind Regards,
Andre
Richard Earnshaw (lists) June 12, 2024, 1:25 p.m. UTC | #3
On 12/06/2024 09:53, Andre Vieira (lists) wrote:
> 
> 
> On 06/06/2024 12:53, Richard Earnshaw (lists) wrote:
>> On 05/06/2024 17:07, Andre Vieira (lists) wrote:
>>> Hi,
>>>
>>> This patch adds missing assembly directives to the CMSE library wrapper to call functions with attribute cmse_nonsecure_call.  Without the .type directive the linker will fail to produce the correct veneer if a call to this wrapper function is to far from the wrapper itself.  The .size was added for completeness, though we don't necessarily have a usecase for it.
>>>
>>> I did not add a testcase as I couldn't get dejagnu to disassemble the linked binary to check we used an appropriate branch instruction, I did however test it locally and with this change the GNU linker now generates an appropriate veneer and call to that veneer when __gnu_cmse_nonsecure_call is too far.
>>>
>>> OK for trunk and backport to any release branches still in support (after waiting a week or so)?
>>>
>>> libgcc/ChangeLog:
>>>
>>>      PR target/115360
>>>      * config/arm/cmse_nonsecure_call.S: Add .type and .size directives.
>>
>> OK.
>>
>> R.
> 
> OK to backport? I was thinking backporting it as far as gcc-11 (we haven't done a 11.5 yet).
> 
> Kind Regards,
> Andre

Yes.

R.
diff mbox series

Patch

diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S
index f93ce6bb4f9f679020c9684c56f5916f1c0bf73c..fef37b955af673fb975dd64229d5e0647afe0d00 100644
--- a/libgcc/config/arm/cmse_nonsecure_call.S
+++ b/libgcc/config/arm/cmse_nonsecure_call.S
@@ -33,6 +33,7 @@ 
 #endif
 
 .thumb
+.type __gnu_cmse_nonsecure_call, %function
 .global __gnu_cmse_nonsecure_call
 __gnu_cmse_nonsecure_call:
 #if defined(__ARM_ARCH_8M_MAIN__)
@@ -142,3 +143,4 @@  pop	    {r5-r7, pc}
 #else
 #error "This should only be used for armv8-m base- and mainline."
 #endif
+.size __gnu_cmse_nonsecure_call, .-__gnu_cmse_nonsecure_call