[ELD] Fix ARM OVERLAY VMA/LMA layout - #1731
[ELD] Fix ARM OVERLAY VMA/LMA layout#1731Steven Ramirez Rosa (Steven6798) wants to merge 1 commit into
Conversation
c0856a8 to
1e07c46
Compare
|
quic-areg I see that the zephyr check fails but I don't know what to make of the results. |
Place OVERLAY members at their shared virtual address and allow the intentional VMA overlap between members of the same OVERLAY. Use the OVERLAY AT() address as the first member's load address and assign consecutive LMAs to subsequent members. Handle overlays without an explicit VMA by deriving the address from the location counter, and preserve declaration order when chaining LMAs, including across empty members. Extend ARM linker-script regression coverage for section and program-header VMA/LMA layouts, empty first members, and reversed member order. Fix: qualcomm#1724 Signed-off-by: Steven Ramirez Rosa <ramirezr@qti.qualcomm.com>
5a0eef1 to
c193a1d
Compare
|
Workflows are failing due to reasons unrelated to this PR. I'll track these issues and re-run this PR after they are fixed. |
Parth (parth-07)
left a comment
There was a problem hiding this comment.
Steven Ramirez Rosa (@Steven6798) We also need to update CreateScriptProgramHeaders to handle correctly handle overlay when the linker script specifies PHDRS.
Thanks. I'll look into this. |
| .vectors.bhb.loop8 { KEEP(*(.vectors.bhb.loop8)) } | ||
| .vectors { KEEP(*(.vectors)) } | ||
| } | ||
| } |
There was a problem hiding this comment.
Can you place something after the overlay to make sure that the location counter is advanced correctly? Something like after = .;. From the issue desc, it looks like we are advancing the location counter after an overlay by the size of the last section rather than the largest section.
cat > 1.s << \!
.section .a, "ax", %progbits
.space 0x20
.section .b, "ax", %progbits
.space 0x40
.section .t, "ax", %progbits
.global _start
_start:
.space 0x10
!
cat > script.t << \!
SECTIONS {
. = 0x1000;
.t : { *(.t) }
OVERLAY 0x9000 : AT(0x8000) { .b { *(.b) } .a { *(.a) } }
after = .;
}
!
clang -target arm-linux-gnueabi -c 1.s
ld.eld 1.o -T script.t -o A
ld.lld 1.o -T script.t -o B
llvm-readelf -s A B | grep after| // prologue; those values belong to the enclosing OverlayDesc. | ||
| if (isOverlayMember) { | ||
| if (overlay->hasStart()) { | ||
| overlay->start()->evaluateAndRaiseError(); |
There was a problem hiding this comment.
Do we need to re-evaluate the start expression for each member?
|
The initial scope of this PR was to address a failure in ARM Linux kernel build. The Overlay feature applies to more than just ARM and it looks like ELD is missing much more than I anticipated. We might need to break this feature into multiple follow-ups, address one thing at a time and test all architectures. This looks like a better approach than to focus everything in one PR focused just on ARM. Any feedback? |
Follow up: #1745 |
Handle OVERLAY members at their shared VMA, assign the first member's AT() LMA, and place subsequent members consecutively. Allow intentional virtual-address overlap between members of the same OVERLAY.
Add an ARM Linux kernel linker-script regression test covering section addresses and program-header VMAs/LMAs.
Fix: #1724