[PATCH v11 13/25] OAv2 merge: create a section for object attributes

Jan Beulich jbeulich@suse.com
Thu Jan 8 13:57:25 GMT 2026


On 31.12.2025 00:05, Matthieu Longo wrote:
> --- a/bfd/elf-attrs.c
> +++ b/bfd/elf-attrs.c
> @@ -802,10 +802,35 @@ static asection *
>  create_object_attributes_section (struct bfd_link_info *info,
>  				  bfd *abfd)
>  {
> -  (void) info;
> -  (void) abfd;
> -  /* TO IMPLEMENT */
> -  return NULL;
> +  asection *sec;
> +  const char *sec_name = get_elf_backend_data (abfd)->obj_attrs_section;
> +  sec = bfd_make_section_with_flags (abfd,
> +				     sec_name,
> +				     (SEC_READONLY
> +				      | SEC_HAS_CONTENTS
> +				      | SEC_DATA));
> +  if (sec == NULL)
> +    info->callbacks->fatal (_("%P: failed to create %s section\n"), sec_name);
> +
> +  /* It is unclear why the format requires a different alignment for
> +     32- vs 64-bit ELF.  This code was copy-pasted from
> +     _bfd_elf_link_create_gnu_property_sec() in bfd/elf-properties.c.  The
> +     original patch which introduced it, does not provide any reason and no
> +     discussion during the patch review focussed on this part of the code.
> +     https://inbox.sourceware.org/binutils/20210624132411.1993105-1-hjl.tools
> +     @gmail.com/  */
> +  unsigned align
> +    = (get_elf_backend_data (info->output_bfd)->s->elfclass == ELFCLASS64
> +       ? 3
> +       : 2);

H.J., repeating my earlier question: Can you please shed some light on the
situation? I would much prefer if the anomaly there wouldn't be duplicated
here.

Matthieu, in the absence of a response from H.J., please use 2 uniformly and
drop the comment.

Jan


More information about the Binutils mailing list