PR28186, SEGV elf.c:7991:30 in _bfd_elf_fixup_group_sections

Message ID YQ5OHmSxO4nEL1Qw@squeak.grove.modra.org
State New
Headers show
Series
  • PR28186, SEGV elf.c:7991:30 in _bfd_elf_fixup_group_sections
Related show

Commit Message

Alan Modra via Binutils Aug. 7, 2021, 9:10 a.m.
PR 28186
	* elf.c (_bfd_elf_fixup_group_sections): Don't segfault on
	objcopy/strip with NULL output_section.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/elf.c b/bfd/elf.c
index 5941eeb010b..380d64d699d 100644
--- 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. */