Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elf: Workaround for segment first section address check in phdr rewrite #12

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bfd/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -7412,14 +7412,15 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd, bfd_vma maxpagesize)
/* If the first section in a segment does not start at
the beginning of the segment, then something is
wrong. */
if (align_power (map->p_paddr
if ((align_power (map->p_paddr
+ (map->includes_filehdr
? iehdr->e_ehsize : 0)
+ (map->includes_phdrs
? iehdr->e_phnum * iehdr->e_phentsize
: 0),
output_section->alignment_power * opb)
!= output_section->lma * opb)
&& (map->p_paddr != output_section->lma * opb))
goto sorry;
}
else
Expand Down