[PATCH v1] obj_attr_v2_record: simplify logic when an attribute already exists
Jan Beulich
jbeulich@suse.com
Mon Jan 26 08:22:19 GMT 2026
On 23.01.2026 17:21, Matthieu Longo wrote:
> ---
> gas/config/obj-elf-attr.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
Okay (implicit by me having suggested the change).
Jan
> --- a/gas/config/obj-elf-attr.c
> +++ b/gas/config/obj-elf-attr.c
> @@ -1062,8 +1062,7 @@ obj_attr_v2_record (obj_attr_tag_t key, arg_t *arg_val)
>
> /* Go over the list of already recorded attributes and check for
> redefinitions (which are forbidden). */
> - bool skip_recording = false;
> - obj_attr_v2_t *recorded_attr = bfd_obj_attr_v2_find_by_tag
> + const obj_attr_v2_t *recorded_attr = bfd_obj_attr_v2_find_by_tag
> (elf_obj_attr_subsections (stdoutput).last, obj_attr->tag, false);
> if (recorded_attr != NULL)
> {
> @@ -1073,11 +1072,7 @@ obj_attr_v2_record (obj_attr_tag_t key, arg_t *arg_val)
> && strcmp (recorded_attr->val.string, obj_attr->val.string) != 0))
> as_bad (_("attribute '%" PRIu64 "' cannot be redefined"),
> recorded_attr->tag);
> - skip_recording = true;
> - }
>
> - if (skip_recording)
> - {
> if (arg_val->vtype == VALUE_STRING)
> free ((void *) obj_attr->val.string);
> free (obj_attr);
More information about the Binutils
mailing list