[v2,1/2] ld: Correct ldelf_place_orphan

Message ID 20250115110347.1718501-2-hjl.tools@gmail.com
State New
Headers
Series Fix orphan_init_done for the object-only output |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

H.J. Lu Jan. 15, 2025, 11:03 a.m. UTC
  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 | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
  

Patch

diff --git a/ld/ldelf.c b/ld/ldelf.c
index a66d1d21394..dfe8032f255 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -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;
     }