[binutils-gdb] obj_attr_v2_record: simplify logic when an attribute already exists

Matthieu Longo mlongo@sourceware.org
Mon Jan 26 10:14:24 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=449035c35f2169e0c690d83f28306275ab7f7463

commit 449035c35f2169e0c690d83f28306275ab7f7463
Author: Matthieu Longo <matthieu.longo@arm.com>
Date:   Fri Jan 23 15:38:57 2026 +0000

    obj_attr_v2_record: simplify logic when an attribute already exists
    
    Suggested-By: Jan Beulich <jbeulich@suse.com>
    Approved-By: Jan Beulich <jbeulich@suse.com>

Diff:
---
 gas/config/obj-elf-attr.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gas/config/obj-elf-attr.c b/gas/config/obj-elf-attr.c
index 7ed781d367c..a731c1f1300 100644
--- 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-cvs mailing list