[obvious] Fix PR30079: abort on mingw

Message ID alpine.LSU.2.20.2302131301550.29328@wotan.suse.de
State Repeat Merge
Headers
Series [obvious] Fix PR30079: abort on mingw |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Michael Matz Feb. 13, 2023, 1:04 p.m. UTC
  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.
---
committed as obvious after convincing myself that I had a thinko here.

 ld/ldlang.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

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);