aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2021-05-07 10:57:47 +0100
committerNick Clifton <nickc@redhat.com>2021-05-07 10:57:47 +0100
commitd820a652a6d3ae3793207016c0c8cc78451eabd0 (patch)
tree3b04ff14349a8e6421aea4c657c64fc8ab6f61f7 /ld
parent9589edb8366d9cf670dbfeeea355337c8b32e6d4 (diff)
downloadgdb-d820a652a6d3ae3793207016c0c8cc78451eabd0.zip
gdb-d820a652a6d3ae3793207016c0c8cc78451eabd0.tar.gz
gdb-d820a652a6d3ae3793207016c0c8cc78451eabd0.tar.bz2
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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/ldelfgen.c15
2 files changed, 14 insertions, 6 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index fa367d3..998c403 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -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
diff --git a/ld/ldelfgen.c b/ld/ldelfgen.c
index 495fa84..c456d47 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