[PATCH] D43228: [ELF] Allow redefining LMA for a section inside a segment.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 19 20:25:28 PST 2018
Two sections in the same PT_LOAD cannot possibly have different deltas
between physical and virtual addresses. How would that be represented at
runtime?
Cheers,
Rafael
Igor Kudrin via Phabricator <reviews at reviews.llvm.org> writes:
> 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