[PATCH] D62177: [ELF] Don't advance position in a memory region when assigning to the Dot
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 21 03:03:09 PDT 2019
peter.smith added a comment.
Thanks for the fix. The MEMORY command is indeed strange. I think that this behaviour is documented in https://sourceware.org/binutils/docs/ld/Output-Section-Address.html#Output-Section-Address
The output section address heuristic is as follows:
If an output memory region is set for the section then it is added to this region and its address will be the next free address in that region.
If the MEMORY command has been used to create a list of memory regions then the first region which has attributes compatible with the section is selected to contain it. The section’s output address will be the next free address in that region; MEMORY.
If no memory regions were specified, or none match the section then the output address will be based on the current value of the location counter.
In the location counter page
> The location counter may not be moved backwards inside an output section, and may not be moved backwards outside of an output section if so doing creates areas with overlapping LMAs.
So I think that the assignment to dot in the test case is ignored when setting the base address of .data due to Memory taking precedence in the above heuristic, as it doesn't create overlapping LMAs it is legal to move the location counter backwards.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62177/new/
https://reviews.llvm.org/D62177
More information about the llvm-commits
mailing list