Skip to content

[ELD] Avoid assigning addresses to headers outside the layout - #2065

Merged
Shankar Easwaran (quic-seaswara) merged 1 commit into
qualcomm:mainfrom
yashwant938:fix/2063-phdrs-without-filehdr
Oct 8, 2026
Merged

Shankar Easwaran (quic-seaswara) merged 1 commit into
qualcomm:mainfrom
yashwant938:fix/2063-phdrs-without-filehdr

Conversation

@yashwant938

Copy link
Copy Markdown
Contributor

Fix a crash when a linker script loads PHDRS without FILEHDR and there is room for the headers before the first output section. allocateHeaders() tries to set the ELF header's physical address even though that header has no output section. FILEHDR without PHDRS has the symmetric problem.

Guard each header's address assignment with its existing layout predicate. Add a regression covering both combinations and checking the resulting load-segment offsets and addresses, with explicit section placement and page alignment for consistent results across targets.

Validation: built ELD against LLVM main with assertions enabled; ran the new regression and surrounding PHDRS/header-placement tests across x86-64, Hexagon, AArch64, ARM, RV32, and RV64. 164 test runs passed, with 10 expected unsupported skips. The full upstream suite was not run.

Fixes #2063

Signed-off-by: yashwant <ranayash2022@gmail.com>
@quic-seaswara
Shankar Easwaran (quic-seaswara) merged commit 809e131 into qualcomm:main Oct 8, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion OE failed in allocateHeaders() when PHDRS is used without FILEHDR and headers fit

2 participants