Another generic ELF target assertion failure

Message ID 20190527045703.GK6820@bubble.grove.modra.org
State New
Headers show
Series
  • Another generic ELF target assertion failure
Related show

Commit Message

Alan Modra May 27, 2019, 4:57 a.m.
After fixing the ld-elf/pr22836-1a segmentation fault we run into an
assertion failure due to the generic ELF target not removing empty
SHT_GROUP sections.  Avoid that.

	* elf.c (bfd_elf_set_group_contents): Exit on zero size section.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/elf.c b/bfd/elf.c
index 952e4bfe11..b463f1df8b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3472,7 +3472,8 @@  bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
 
   /* Ignore linker created group section.  See elfNN_ia64_object_p in
      elfxx-ia64.c.  */
-  if (((sec->flags & (SEC_GROUP | SEC_LINKER_CREATED)) != SEC_GROUP)
+  if ((sec->flags & (SEC_GROUP | SEC_LINKER_CREATED)) != SEC_GROUP
+      || sec->size == 0
       || *failedptr)
     return;