[PATCH] elf: Keep zero-sized relocation section in section group

Fangrui Song i@maskray.me
Fri Apr 3 06:34:39 GMT 2020


On 2020-04-03, Alan Modra via Binutils wrote:
>On Thu, Apr 02, 2020 at 08:41:18PM -0700, H.J. Lu via Binutils wrote:
>> We must keep zero-sized relocation section in a section group.  Otherwise,
>> the relocation section will be missing from the section group.
>
>Wouldn't it be better to get rid of these bogus relocation sections?
>Should be possible with a change to _bfd_elf_fixup_group_sections, I
>think.
>
>-- 
>Alan Modra
>Australia Development Lab, IBM

"19990502 sourceware import" contains

+      if (o->reloc_count > 0)
+       o->flags |= SEC_RELOC;
+      else
+       {
+         /* 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.  */
+         o->flags &=~ SEC_RELOC;
+       }

"this is probably a bug" Shouldn't we fix the bug?



More information about the Binutils mailing list