diff options
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 4194614..71e16cc 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1133,15 +1133,21 @@ wild_section (ptr, section, file, output) lang_list_init (&list); wild_doit (&list, s, output, file); - ASSERT (list.head != NULL && list.head->next == NULL); - for (pp = &ptr->children.head; - *pp != before; - pp = &(*pp)->next) - ASSERT (*pp != NULL); + /* If we are discarding the section, LIST.HEAD will + be NULL. */ + if (list.head != NULL) + { + ASSERT (list.head->next == NULL); + + for (pp = &ptr->children.head; + *pp != before; + pp = &(*pp)->next) + ASSERT (*pp != NULL); - list.head->next = *pp; - *pp = list.head; + list.head->next = *pp; + *pp = list.head; + } } } } |