[PATCH v10 21/28] OAv2 merge: translate GNU properties to Object Attributes v2 (and vice versa)
Jan Beulich
jbeulich@suse.com
Wed Dec 10 11:34:03 GMT 2025
On 20.11.2025 18:59, Matthieu Longo wrote:
> --- a/bfd/elf-attrs.c
> +++ b/bfd/elf-attrs.c
> @@ -847,16 +847,26 @@ create_object_attributes_section (struct bfd_link_info *info,
> static void
> oav2_translate_gnu_props_to_obj_attrs (const bfd *abfd)
> {
> - (void) abfd;
> - /* TO IMPLEMENT */
> + const struct elf_backend_data *be = get_elf_backend_data (abfd);
> + if (be->translate_gnu_props_to_obj_attrs == NULL)
> + return;
> +
> + for (elf_property_list *p = elf_properties (abfd); p != NULL; p = p->next)
const?
> + be->translate_gnu_props_to_obj_attrs (abfd, p);
> }
>
> /* Translate object attributes v2 that have GNU properties equivalents. */
> static void
> oav2_translate_obj_attrs_to_gnu_props (bfd *abfd)
> {
> - (void) abfd;
> - /* TO IMPLEMENT */
> + const struct elf_backend_data *be = get_elf_backend_data (abfd);
> + if (be->translate_obj_attrs_to_gnu_props == NULL)
> + return;
> +
> + for (obj_attr_subsection_v2_t *subsec = elf_obj_attr_subsections (abfd).first;
const?
> + subsec != NULL;
> + subsec = subsec->next)
> + be->translate_obj_attrs_to_gnu_props (abfd, subsec);
> }
>
> /* Compact duplicated tag declarations in a same subsection.
> --- a/bfd/elf-bfd.h
> +++ b/bfd/elf-bfd.h
> @@ -1663,6 +1663,14 @@ struct elf_backend_data
> /* The size of the array of known subsections. */
> const size_t obj_attr_v2_known_subsections_size;
>
> + /* Translate GNU properties that have object attributes v2 equivalents. */
> + void (*translate_gnu_props_to_obj_attrs) (const bfd *,
> + const elf_property_list *);
> +
> + /* Translate object attributes v2 that have GNU properties equivalents. */
> + void (*translate_obj_attrs_to_gnu_props) (bfd *,
> + const obj_attr_subsection_v2_t *);
How come bfd * is const-ified in just one of the two cases? I would have#
expected the two hooks to be symmetric.
Jan
More information about the Binutils
mailing list