[PATCH] D43228: [ELF] Allow redefining LMA for a section inside a segment.
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 15 21:44:18 PST 2018
ikudrin added a comment.
I don't see anything that violates the specs. With this patch, the offset of a segment (`p_offset`) is still congruent to its virtual address (`p_vaddr`), modulo page size. This rule is enforced in lines 1850-1852 of `ELF/Writer.cpp`:
if (Cmd == First)
return alignTo(Off, std::max<uint64_t>(Cmd->Alignment, Config->MaxPageSize),
Cmd->Addr);
and I didn't touch them.
The description for AT output section attribute says that it defines a load address of the section and that this feature is designed to simplify creating a ROM image. This is exactly what we use it for. https://sourceware.org/binutils/docs/ld/Output-Section-LMA.html
If there are no prescribed program headers in a linker script, the linker creates a new segment on each section with customized LMA, and this is OK and expected (https://reviews.llvm.org/D43284). But in case of explicitly defined segments, we, in fact, ignore some of AT directives. And this contradicts the user's intention.
https://reviews.llvm.org/D43228
More information about the llvm-commits
mailing list