mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-28 23:39:35 +08:00
elf: Remove zero-sized relocation section from section group
Remove zero-sized relocation section from a section group since it has been removed from the output. PR ld/25767 * elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized relocation section from section group.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2020-04-03 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR ld/25767
|
||||||
|
* elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized
|
||||||
|
relocation section from section group.
|
||||||
|
|
||||||
2020-04-02 Jan W. Jagersma <jwjagersma@gmail.com>
|
2020-04-02 Jan W. Jagersma <jwjagersma@gmail.com>
|
||||||
|
|
||||||
* bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
|
* bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
|
||||||
|
37
bfd/elf.c
37
bfd/elf.c
@ -7929,19 +7929,34 @@ _bfd_elf_fixup_group_sections (bfd *ibfd, asection *discarded)
|
|||||||
elf_section_flags (s->output_section) &= ~SHF_GROUP;
|
elf_section_flags (s->output_section) &= ~SHF_GROUP;
|
||||||
elf_group_name (s->output_section) = NULL;
|
elf_group_name (s->output_section) = NULL;
|
||||||
}
|
}
|
||||||
/* Conversely, if the member section is not being output
|
else
|
||||||
but the SHT_GROUP section is, then adjust its size. */
|
|
||||||
else if (s->output_section == discarded
|
|
||||||
&& isec->output_section != discarded)
|
|
||||||
{
|
{
|
||||||
struct bfd_elf_section_data *elf_sec = elf_section_data (s);
|
struct bfd_elf_section_data *elf_sec = elf_section_data (s);
|
||||||
removed += 4;
|
if (s->output_section == discarded
|
||||||
if (elf_sec->rel.hdr != NULL
|
&& isec->output_section != discarded)
|
||||||
&& (elf_sec->rel.hdr->sh_flags & SHF_GROUP) != 0)
|
{
|
||||||
removed += 4;
|
/* Conversely, if the member section is not being
|
||||||
if (elf_sec->rela.hdr != NULL
|
output but the SHT_GROUP section is, then adjust
|
||||||
&& (elf_sec->rela.hdr->sh_flags & SHF_GROUP) != 0)
|
its size. */
|
||||||
removed += 4;
|
removed += 4;
|
||||||
|
if (elf_sec->rel.hdr != NULL
|
||||||
|
&& (elf_sec->rel.hdr->sh_flags & SHF_GROUP) != 0)
|
||||||
|
removed += 4;
|
||||||
|
if (elf_sec->rela.hdr != NULL
|
||||||
|
&& (elf_sec->rela.hdr->sh_flags & SHF_GROUP) != 0)
|
||||||
|
removed += 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Also adjust for zero-sized relocation member
|
||||||
|
section. */
|
||||||
|
if (elf_sec->rel.hdr != NULL
|
||||||
|
&& elf_sec->rel.hdr->sh_size == 0)
|
||||||
|
removed += 4;
|
||||||
|
if (elf_sec->rela.hdr != NULL
|
||||||
|
&& elf_sec->rela.hdr->sh_size == 0)
|
||||||
|
removed += 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s = elf_next_in_group (s);
|
s = elf_next_in_group (s);
|
||||||
if (s == first)
|
if (s == first)
|
||||||
|
Reference in New Issue
Block a user