diff --git a/ld/ChangeLog b/ld/ChangeLog index 49e580d2345..2dad0b9878d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2021-01-13 H.J. Lu + + * ldelfgen.c (add_link_order_input_section): Check for ELF input + before accessing ELF section data. + 2021-01-13 Alan Modra * Makefile.in: Regenerate. diff --git a/ld/ldelfgen.c b/ld/ldelfgen.c index 8014e2229b9..47e7a2a68ed 100644 --- a/ld/ldelfgen.c +++ b/ld/ldelfgen.c @@ -79,7 +79,8 @@ add_link_order_input_section (lang_input_section_type *is, os_info->isec[os_info->count].idx = os_info->count; os_info->count++; s = is->section; - if ((s->flags & SEC_LINKER_CREATED) == 0 + if (s->owner->xvec->flavour == bfd_target_elf_flavour + && (s->flags & SEC_LINKER_CREATED) == 0 && elf_section_data (s) != NULL && elf_linked_to_section (s) != NULL) os_info->ordered++;