When computing section link order for a relocateable link, ignore section sizes.

* ldelfgen.c (compare_link_order): Ignore section size when
	performing a relocateable link.
This commit is contained in:
Nick Clifton 2021-05-07 10:57:47 +01:00
parent 9589edb836
commit d820a652a6
2 changed files with 14 additions and 6 deletions

View 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> 2021-05-07 Alan Modra <amodra@gmail.com>
* ldexp.c (update_definedness): Don't return false for absolute * ldexp.c (update_definedness): Don't return false for absolute

View File

@ -171,12 +171,15 @@ compare_link_order (const void *a, const void *b)
else if (apos > bpos) else if (apos > bpos)
return 1; return 1;
/* The only way we should get matching LMAs is when the first of two if (! bfd_link_relocatable (&link_info))
sections has zero size. */ {
if (asec->size < bsec->size) /* The only way we should get matching LMAs is when
return -1; the first of the two sections has zero size. */
else if (asec->size > bsec->size) if (asec->size < bsec->size)
return 1; return -1;
else if (asec->size > bsec->size)
return 1;
}
/* If they are both zero size then they almost certainly have the same /* 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 VMA and thus are not ordered with respect to each other. Test VMA