public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf: Keep zero-sized relocation section in section group
@ 2020-04-03  3:41 H.J. Lu
  2020-04-03  4:45 ` Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2020-04-03  3:41 UTC (permalink / raw)
  To: binutils

We must keep zero-sized relocation section in a section group.  Otherwise,
the relocation section will be missing from the section group.

	PR ld/25767
	* elflink.c (bfd_elf_final_link): Keep zero-sized relocation
	section in section group.
---
 bfd/elflink.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 7c0849423a..3b29cc127a 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12058,11 +12058,15 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
 
       if (o->reloc_count > 0)
 	o->flags |= SEC_RELOC;
-      else
+      else if (info->resolve_section_groups || !elf_group_name (o))
 	{
 	  /* Explicitly clear the SEC_RELOC flag.  The linker tends to
 	     set it (this is probably a bug) and if it is set
-	     assign_section_numbers will create a reloc section.  */
+	     assign_section_numbers will create a reloc section.
+
+	     PR ld/25767: We must keep zero-sized relocation section
+	     in a section group.  Otherwise, that relocation section
+	     will be missing from the section group.  */
 	  o->flags &=~ SEC_RELOC;
 	}
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-04  2:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03  3:41 [PATCH] elf: Keep zero-sized relocation section in section group H.J. Lu
2020-04-03  4:45 ` Alan Modra
2020-04-03  6:34   ` Fangrui Song
2020-04-03 20:49     ` H.J. Lu
2020-04-03 20:48   ` [PATCH] elf: Remove zero-sized relocation section from " H.J. Lu
2020-04-04  0:36     ` Alan Modra
2020-04-04  1:56       ` H.J. Lu
2020-04-04  2:05         ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).