[PATCH v10 23/28] aarch64: merge of Object Attributes v2 during linkage
Jan Beulich
jbeulich@suse.com
Fri Dec 19 08:52:43 GMT 2025
On 20.11.2025 18:59, Matthieu Longo wrote:
> --- a/bfd/elf-attrs.c
> +++ b/bfd/elf-attrs.c
> @@ -1167,12 +1167,12 @@ gnu_testing_merge_subsection (const char *subsec_name)
> }
>
> /* Merge policy Integer-AND: apply bitwise AND between REF and RHS. */
> -static obj_attr_v2_merge_result_t
> -obj_attr_v2_merge_AND (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
> - const bfd *abfd ATTRIBUTE_UNUSED,
> - const obj_attr_subsection_v2_t *subsec,
> - const obj_attr_v2_t *ref, const obj_attr_v2_t *rhs,
> - const obj_attr_v2_t *frozen ATTRIBUTE_UNUSED)
> +obj_attr_v2_merge_result_t
> +_bfd_obj_attr_v2_merge_AND (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
> + const bfd *abfd ATTRIBUTE_UNUSED,
> + const obj_attr_subsection_v2_t *subsec,
> + const obj_attr_v2_t *ref, const obj_attr_v2_t *rhs,
> + const obj_attr_v2_t *frozen ATTRIBUTE_UNUSED)
> {
> BFD_ASSERT (subsec->encoding == OA_ENC_ULEB128);
>
> @@ -1319,7 +1319,7 @@ oav2_attr_merge (const struct bfd_link_info *info,
> if (lhs->tag <= 1)
> {
> if (policy == SUBSECTION_TESTING_MERGE_AND_POLICY)
> - res = obj_attr_v2_merge_AND (info, abfd, subsec, lhs, rhs, frozen);
> + res = _bfd_obj_attr_v2_merge_AND (info, abfd, subsec, lhs, rhs, frozen);
> else if (policy == SUBSECTION_TESTING_MERGE_OR_POLICY)
> res = obj_attr_v2_merge_OR (info, abfd, subsec, lhs, rhs, frozen);
> else if (policy == SUBSECTION_TESTING_MERGE_ADD_POLICY)
> --- a/bfd/elf-attrs.h
> +++ b/bfd/elf-attrs.h
> @@ -20,6 +20,7 @@
>
> #pragma once
>
> +#include "hidden.h"
> #include <stdint.h>
>
> typedef enum obj_attr_version {
> @@ -208,3 +209,13 @@ typedef struct {
> enum obj_attr_v2_merge_result_reason reason;
> } obj_attr_v2_merge_result_t;
>
> +/* Re-usable merge policies. */
> +/* For now, only AND-merge is used by AArch64 backend. Additional policies
> + (Integer-OR, String-ADD) are part of the GNU testing namespace. If they
> + appear to be usefull for a backend at some point, they should be exposed
> + to the backend here below. */
> +extern obj_attr_v2_merge_result_t
> +_bfd_obj_attr_v2_merge_AND (const struct bfd_link_info *, const bfd *,
> + const obj_attr_subsection_v2_t *,
> + const obj_attr_v2_t *, const obj_attr_v2_t *,
> + const obj_attr_v2_t *) ATTRIBUTE_HIDDEN;
Btw, I wouldn't mind if this function (and perhaps also its two siblings) were
introduced like this right away in the earlier patch. They remain internal to
libbfd, after all. (I wouldn't like unnecessary exported functions to be added
to the library.)
Jan
More information about the Binutils
mailing list