Conversation
|
I'm finding more elfs with segments before the start of flash. For example, when working with multiple address libtock-rs apps, I got this elf: Flash starts at 0x00048000, but the first load segment is at 0x00040000. |
|
What you're seeing here is the behavior I described in tock/libtock-rs#477. I'm pretty sure the above ELF is an example of a linker bug. |
|
It seems like llvm ld really likes to have a segment aligned to 0x10000. So the "typical" app at 0x40000 looks ok: but then for apps at "intermediate" addresses: There are two segments that start at 0x40000 still. |
|
This is not too surprising to me, as that's the exact reason I added this change: tock/libtock-rs#477. However, for me it was alignment to Which LLVM toolchain are you using? An align of |
|
I added Which looks more reasonable. |
|
Latest update: tock/libtock-rs#495 |
|
For fun, I tried to build the original problem app (bare bones with STACK=0) with an alignment of 1: diff --git a/Configuration.mk b/Configuration.mk
index 166cbd1..2c1bddc 100644
--- a/Configuration.mk
+++ b/Configuration.mk
@@ -180,7 +180,8 @@ override CPPFLAGS += \
override WLFLAGS += \
-Wl,--warn-common\
-Wl,--gc-sections\
- -Wl,--build-id=none
+ -Wl,--build-id=none\
+ -Wl,-zmax-page-size=1The elf is different yet, but still not workable without this change: |
The linker appears to be able to place segements before the start of flash. We detect this case and edit the segment to remove the portion that exists before the specified start of flash.
d23d6b8 to
8ab90b7
Compare
|
I think it's time to decide on this. I say we go ahead with it. I don't know how else to fix |
|
Sure. I didn't get to test this only my WIP code just yet, but it seems like a strict improvement over the current state. |
This is an alternative to #74.
The linker appears to be able to place segments before the start of flash. We detect this case and edit the segment to remove the portion that exists before the specified start of flash.
This if merged would be the end of an era: I've finally given in to use symbols to transfer information from the linker script to elf2tab.