]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ld: Correct ldelf_place_orphan
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 15 Jan 2025 10:11:47 +0000 (18:11 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 15 Jan 2025 12:26:23 +0000 (20:26 +0800)
Remove the extra for loop and if statement in ldelf_place_orphan.

* ldelf.c (ldelf_place_orphan): Remove the extra for loop and if
statement.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
ld/ldelf.c

index a66d1d2139427aed3a1d3178671534d487cf737b..dfe8032f2559f9cef6f51dce4bd837b6aa1c3cc7 100644 (file)
@@ -2275,19 +2275,17 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
     {
       struct orphan_save *ho, *horig;
 
-      for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho)
       for (ho = hold, horig = orig_hold;
           ho < hold + ARRAY_SIZE (hold);
           ++ho, ++horig)
        {
          *ho = *horig;
          if (ho->name != NULL)
-       if (ho->name != NULL)
-         {
-           ho->os = lang_output_section_find (ho->name);
-           if (ho->os != NULL && ho->os->flags == 0)
-             ho->os->flags = ho->flags;
-         }
+           {
+             ho->os = lang_output_section_find (ho->name);
+             if (ho->os != NULL && ho->os->flags == 0)
+               ho->os->flags = ho->flags;
+           }
        }
       orphan_init_done = true;
     }