When computing section link order for a relocateable link, ignore section sizes.
authorNick Clifton <nickc@redhat.com>
Fri, 7 May 2021 09:57:47 +0000 (10:57 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 7 May 2021 09:57:47 +0000 (10:57 +0100)
* ldelfgen.c (compare_link_order): Ignore section size when
performing a relocateable link.

ld/ChangeLog
ld/ldelfgen.c

index fa367d3e69c582233c116d0be75a865dee55cb1e..998c403382e8cdbd82786d89ec06b3b2c787519d 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-07  Nick Clifton  <nickc@redhat.com>
+
+       * ldelfgen.c (compare_link_order): Ignore section size when
+       performing a relocateable link.
+
 2021-05-07  Alan Modra  <amodra@gmail.com>
 
        * ldexp.c (update_definedness): Don't return false for absolute
index 495fa8451fcc683e6c615ce2fd95cc59a9dfdcd7..c456d4751e166b55ee59004130bdfe672a9a7a6e 100644 (file)
@@ -171,12 +171,15 @@ compare_link_order (const void *a, const void *b)
   else if (apos > bpos)
     return 1;
 
-  /* The only way we should get matching LMAs is when the first of two
-     sections has zero size.  */
-  if (asec->size < bsec->size)
-    return -1;
-  else if (asec->size > bsec->size)
-    return 1;
+  if (! bfd_link_relocatable (&link_info))
+    {
+      /* The only way we should get matching LMAs is when
+        the first of the two sections has zero size.  */
+      if (asec->size < bsec->size)
+       return -1;
+      else if (asec->size > bsec->size)
+       return 1;
+    }
 
   /* If they are both zero size then they almost certainly have the same
      VMA and thus are not ordered with respect to each other.  Test VMA
This page took 0.027858 seconds and 4 git commands to generate.