summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2023-02-09 15:29:00 +0100
committerMichael Matz <matz@suse.de>2023-02-13 13:52:02 +0100
commitb7eab2a9d4f4e92692daf14b09fc95ca11b72e30 (patch)
treeb97f6fc73c9d959d31c7778e5f4269e19775bb2e /ld
parent0d2f72332c7606fa3181b54dceef82d1af403624 (diff)
downloadbinutils-gdb-b7eab2a9d4f4e92692daf14b09fc95ca11b72e30.tar.gz
Fix PR30079: abort on mingw
the early-out in wild_sort is not enough, it might still be that filenames are equal _and_ the wildcard list doesn't specify a sort order either. Don't call compare_section then. Tested on all targets.
Diffstat (limited to 'ld')
-rw-r--r--ld/ldlang.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 84a2914fc26..b5e0d026ae4 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -649,7 +649,8 @@ wild_sort (lang_wild_statement_type *wild,
looking at the sections for this file. */
/* Find the correct node to append this section. */
- if (compare_section (sec->spec.sorted, section, (*tree)->section) < 0)
+ if (sec && sec->spec.sorted != none && sec->spec.sorted != by_none
+ && compare_section (sec->spec.sorted, section, (*tree)->section) < 0)
tree = &((*tree)->left);
else
tree = &((*tree)->right);