[PATCH v8 10/19] bfd: add support for copying Object Attributes v2
Jan Beulich
jbeulich@suse.com
Fri Aug 8 13:14:53 GMT 2025
On 15.07.2025 13:39, Matthieu Longo wrote:
> +/* Copy the object attributes from IBFD to OBFD. */
> +void
> +_bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd)
> +{
> + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
> + || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
> + return;
> +
> + obj_attr_version_t version = elf_obj_attr_version (ibfd);
> + elf_obj_attr_version (obfd) = version;
> +
> + if (version == OBJ_ATTR_VERSION_NONE)
> + return;
> + else if (version == OBJ_ATTR_V1)
> + oav1_copy_attributes (ibfd, obfd);
> + else if (version == OBJ_ATTR_V2)
> + oav2_copy_attributes (ibfd, obfd);
> + else
> + abort ();
And yet another case where imo switch() wants using, both for readability
and for ease of future extension.
Jan
More information about the Binutils
mailing list