[PATCH v8 10/19] bfd: add support for copying Object Attributes v2
Matthieu Longo
matthieu.longo@arm.com
Thu Aug 14 17:01:28 GMT 2025
On 2025-08-08 14:14, Jan Beulich wrote:
> 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
Fixed in the next revision.
Matthieu
More information about the Binutils
mailing list