mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 16:05:56 +08:00
elf: Verify section size for mixed ordered/unordered inputs
When fixing up SHF_LINK_ORDER, issue a fatal error if the output section size is increased. Otherwise, bfd_set_section_contents will fail later when attempting to write contents past the end of the output section. PR ld/26256 PR ld/27160 * elflink.c (elf_fixup_link_order): Verify that fixing up SHF_LINK_ORDER doesn't increase the output section size.
This commit is contained in:
@ -12039,6 +12039,14 @@ elf_fixup_link_order (struct bfd_link_info *info, bfd *abfd, asection *o)
|
||||
offset = sections[n]->offset + sections[n]->size;
|
||||
|
||||
free (sections);
|
||||
|
||||
/* Verify that fixing up SHF_LINK_ORDER doesn't increase the section
|
||||
size. */
|
||||
if (offset > o->size)
|
||||
info->callbacks->einfo
|
||||
(_("%F%P: %pA has ordered sections with incompatible alignments\n"),
|
||||
o);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user