]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
obj_attr_v2_record: simplify logic when an attribute already exists
authorMatthieu Longo <matthieu.longo@arm.com>
Fri, 23 Jan 2026 15:38:57 +0000 (15:38 +0000)
committerMatthieu Longo <matthieu.longo@arm.com>
Mon, 26 Jan 2026 10:14:10 +0000 (10:14 +0000)
Suggested-By: Jan Beulich <jbeulich@suse.com>
Approved-By: Jan Beulich <jbeulich@suse.com>
gas/config/obj-elf-attr.c

index 7ed781d367cfe4954ce43f89bf297f737cb07c64..a731c1f13007f06e9165c792f2a2ff52be4bb70a 100644 (file)
@@ -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);