PR28186, SEGV elf.c:7991:30 in _bfd_elf_fixup_group_sections
authorAlan Modra <amodra@gmail.com>
Sat, 7 Aug 2021 04:40:38 +0000 (14:10 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 7 Aug 2021 05:26:53 +0000 (14:56 +0930)
PR 28186
* elf.c (_bfd_elf_fixup_group_sections): Don't segfault on
objcopy/strip with NULL output_section.

bfd/elf.c

index 5941eeb010bef549605beb166938793ae398edff..380d64d699d4632f5982faf946894ef9e744613c 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -7985,7 +7985,7 @@ _bfd_elf_fixup_group_sections (bfd *ibfd, asection *discarded)
                    isec->flags |= SEC_EXCLUDE;
                  }
              }
-           else
+           else if (isec->output_section != NULL)
              {
                /* Adjust the output section size when called from
                   objcopy. */