[PATCH v2 1/2] ld: aarch64: Fix scanning of GNU properties for AARCH64_FEATURE_1_AND

Richard Earnshaw (lists) Richard.Earnshaw@arm.com
Tue Apr 1 15:23:27 GMT 2025


On 01/04/2025 16:06, Yury Khrustalev wrote:
> Fixes [1]. Previously iteration over GNU properties of an input file
> could stop before reaching GNU_PROPERTY_AARCH64_FEATURE_1_AND which
> would result in incorrect inference of properties of the output file.
> 
> In the particular use case described in [1], the memory seal property
> GNU_PROPERTY_MEMORY_SEAL with number 3, if present in the input file,
> prevented reading information from GNU_PROPERTY_AARCH64_FEATURE_1_AND
> property due to filtering by property number.
> 
> [1] PR32818 https://sourceware.org/bugzilla/show_bug.cgi?id=32818
> ---
>  bfd/elfxx-aarch64.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
> index 45a02058e81..072e8de7bf8 100644
> --- a/bfd/elfxx-aarch64.c
> +++ b/bfd/elfxx-aarch64.c
> @@ -936,8 +936,7 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info)
>      {
>        /* The property list is sorted in order of type.  */

So this comment is wrong and should be corrected, I presume.

>        for (elf_property_list *p = elf_properties (pbfd);
> -	   (p != NULL)
> -	   && (GNU_PROPERTY_AARCH64_FEATURE_1_AND <= p->property.pr_type);
> +	   (p != NULL);
>  	   p = p->next)
>  	{
>  	  /* This merge of features should happen only once as all the identical

R.


More information about the Binutils mailing list