[PATCH v2] bfd/ELF: fix BFD library build --enable-shared

Jan Beulich jbeulich@suse.com
Mon Jan 26 08:24:21 GMT 2026


On 23.01.2026 17:19, Matthieu Longo wrote:
> The patch series that added support for Object Attributes v2 introduced
> regressions when building the BFD library as a shared object.
> 
> Incorrect usages of ATTRIBUTE_HIDDEN caused the following link-time errors:
> 
> /usr/bin/ld: config/obj-elf-attr.o: in function `obj_attr_v2_record':
> obj-elf-attr.c: undefined reference to `bfd_elf_obj_attr_v2_init'
> obj-elf-attr.c: undefined reference to `_bfd_obj_attr_v2_find_by_tag'
> obj-elf-attr.c: undefined reference to `obj_attr_v2_t_append'
> /usr/bin/ld: config/obj-elf-attr.o: in function `obj_attr_v2_subsection_record':
> obj-elf-attr.c: undefined reference to `obj_attr_subsection_v2_t_append'
> obj-elf-attr.c: undefined reference to `obj_attr_subsection_v2_t_remove'
> obj-elf-attr.c: undefined reference to `obj_attr_subsection_v2_t_append'
> 
> This patch fixes the symbols visibility so that the BFD library links
> correctly when built with --enable-shared.
> The ATTRIBUTE_HIDDEN annotations were removed from bfd_elf_obj_attr_v2_init
> and _bfd_obj_attr_v2_find_by_tag, and the functions were renamed to reflect
> the belonging to the public BFD API using the 'bfd_' prefix.

Nit: Only one of the functions was actually renamed.

> The doubly linked
> list helpers remain hidden and are instead exposed through wrapper functions.
> ---
>  bfd/elf-attrs.c           | 28 +++++++++++++++++++++++++++-
>  bfd/elf-bfd.h             | 12 +++++++++---
>  bfd/elfnn-aarch64.c       |  2 +-
>  bfd/elfxx-aarch64.c       |  6 +++---
>  gas/config/obj-elf-attr.c | 10 +++++-----
>  5 files changed, 45 insertions(+), 13 deletions(-)

Okay.

Jan


More information about the Binutils mailing list