[PATCH] D44780: [ELF] - Implement linker script OVERLAYs.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 28 08:17:17 PDT 2018
grimar added inline comments.
================
Comment at: ELF/LinkerScript.h:315
+ // that were seen in overlay descriptions.
+ llvm::DenseSet<OutputSection *> OverlaySections;
};
----------------
espindola wrote:
> This could be a bit in OutputSection, no?
Yes. Ok.
================
Comment at: ELF/ScriptParser.cpp:451
+ if (Prev)
+ Cmd->LMAExpr = [=] { return Prev->LMAExpr().getValue() + Prev->Size; };
+ else
----------------
espindola wrote:
> Are we missing the alignment?
GNU ld does not seem to respect the alignment here.
For example for code and script:
```
.section .aaa, "a";
.byte 0;
.section .bbb, "a";
.align 4;
.byte 0;
```
```
SECTIONS {
. = 0x1000;
OVERLAY 0x1000 : AT ( 0x4000 ) {
.aaa { *(.aaa) }
.bbb { *(.bbb) }
}
}
```
Output is:
```
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .aaa PROGBITS 0000000000001000 00001000
0000000000000001 0000000000000000 A 0 0 1
[ 2] .bbb PROGBITS 0000000000001000 00002000
0000000000000001 0000000000000000 A 0 0 4
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0x0000000000001000 0x0000000000004000
0x0000000000000001 0x0000000000000001 R 1000
LOAD 0x0000000000002000 0x0000000000001000 0x0000000000004001
0x0000000000000001 0x0000000000000001 R 1000
Section to Segment mapping:
Segment Sections...
00 .aaa
01 .bbb
```
And I might be missing something, but it seems correct to me. I see no reason to
waste space with alignments for OVERLAYs, because overlay manager is responsible to
copy sections in and out of the runtime memory address and therefore I think alignment
is just unuseful here.
(4.6.9 Overlay Description, https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/sections.html)
https://reviews.llvm.org/D44780
More information about the llvm-commits
mailing list