[PATCH] arm: emit .type %function directive in FUNC_START macro

Richard Earnshaw (lists) Richard.Earnshaw@arm.com
Wed Jun 26 11:56:21 GMT 2024


On 26/06/2024 10:07, Christophe Lyon wrote:
> The linker needs to know whether a symbol is STT_FUNCTION when
> deciding which farcall stub to emit (if needed), this patch adds this
> to the FUNC_START macro which is used in crt0.

OK.

R.

> ---
>  libgloss/arm/crt0.S         | 2 ++
>  libgloss/arm/redboot-crt0.S | 2 ++
>  newlib/libc/sys/arm/crt0.S  | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
> index cd1a20d61..9ff0e6323 100644
> --- a/libgloss/arm/crt0.S
> +++ b/libgloss/arm/crt0.S
> @@ -48,6 +48,7 @@
>  	.thumb
>  .macro FUNC_START name
>  	.global \name
> +	.type \name, %function
>  	.thumb_func
>  \name:
>  .endm
> @@ -55,6 +56,7 @@
>  	.code 32
>  .macro FUNC_START name
>  	.global \name
> +	.type \name, %function
>  \name:
>  .endm
>  #endif
> diff --git a/libgloss/arm/redboot-crt0.S b/libgloss/arm/redboot-crt0.S
> index 0e3a9b4e2..c9f3440ac 100644
> --- a/libgloss/arm/redboot-crt0.S
> +++ b/libgloss/arm/redboot-crt0.S
> @@ -17,6 +17,7 @@
>  #ifdef PREFER_THUMB
>  .macro FUNC_START name
>  	.global \name
> +	.type \name, %function
>  	.thumb_func
>  \name:
>  .endm
> @@ -24,6 +25,7 @@
>  #else
>  .macro FUNC_START name
>  	.global \name
> +	.type \name, %function
>  \name:
>  .endm
>  	.code 32
> diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S
> index 90d5be393..dae0f0465 100644
> --- a/newlib/libc/sys/arm/crt0.S
> +++ b/newlib/libc/sys/arm/crt0.S
> @@ -48,6 +48,7 @@
>  	.thumb
>  .macro FUNC_START name
>  	.global \name
> +	.type \name, %function
>  	.thumb_func
>  \name:
>  .endm
> @@ -55,6 +56,7 @@
>  	.code 32
>  .macro FUNC_START name
>  	.global \name
> +	.type \name, %function
>  \name:
>  .endm
>  #endif



More information about the Newlib mailing list