No subject
Nick Clifton
nickc@redhat.com
Fri May 7 09:57:37 GMT 2021
Hi Guys,
I am checking in the patch below to fix a quirk of the section
comparison function used in ldelfgen.c. Before now if a relocatable
link was being performed sections could be reordered based upon their
size. This is not necessarily a problem per-se, but for the ARM, it
meant that .ARM.exidx sections could be reordered with respect to
.ARM.extab sections, causing potential problems with unwinding.
Cheers
Nick
ld/ChangeLog
2021-05-07 Nick Clifton <nickc@redhat.com>
* ldelfgen.c (compare_link_order): Ignore section size when
performing a relocateable link.
diff --git a/ld/ldelfgen.c b/ld/ldelfgen.c
index 495fa8451fc..c456d4751e1 100644
--- a/ld/ldelfgen.c
+++ b/ld/ldelfgen.c
@@ -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
More information about the Binutils
mailing list