-
Notifications
You must be signed in to change notification settings - Fork 112
Link with LLD #18
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Link with LLD #18
Conversation
FLASH (rx) : ORIGIN = 0x80000000, LENGTH = PROG_LENGTH | ||
SRAM (RWX) : ORIGIN = 0x00000000, LENGTH = RAM_LENGTH | ||
FLASH (rx) : ORIGIN = 0x80000000, LENGTH = 0x0040000 | ||
SRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 0x0010000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to inline those to make lld
happy.
"linker-is-gnu": true, | ||
"disable-redzone": true, | ||
"pre-link-args": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why but the pre-link-args
section stopped having any effect on the linker, so I had to move that part to .cargo/config
.
This is awesome, we need this too because it's a prerequisite to dealing with global variables (gnu ld doesn't know how to link LLVM's pic strategies that we need to use). Will take a look soon, but high level if it works for the example apps I think we should merge and deal with bugs as they arise |
Seems like efl2tbf doesn't work with the new output files. When running blink I now get a panic: tock/tock#817 |
We tested LLD on our NRF52DK on three different PCs running Ubuntu Linux. |
I on Mac, but I don't have a nRF52dk board. I updated the submodule to the correct commit (it has some change in a cargo.lock file but is otherwise the same).
I have no idea what linker script it is using, but it doesn't seem to be layout.ld in the repo. What does the output of |
If your repo is clean except for The intention is that My outputs: $ cargo --version
cargo 0.26.0-nightly (1d6dfea44 2018-01-26) $ rustc --version
rustc 1.26.0-nightly (c9334404f 2018-03-05) $ tockloader inspect-tab target/blink.tab
Inspecting TABs...
TAB: blink
build-date: 2018-03-18 16:44:11+00:00
only-for-boards:
tab-version: 1
supported architectures: cortex-m4
TBF Header
package_name : blink
version : 2
checksum : 0x6e4c6c2d
flags : 1 0x1
enabled : Yes
sticky : No
header_size : 44 0x2c
init_fn_offset : 37 0x25
minimum_ram_size : 4096 0x1000
protected_size : 0 0x0
total_size : 4096 0x1000 |
I can't explain this but with a new checkout it works. #thanksrust |
I can't get this to work if I have the repo inside my |
@bradjc is it possible you have some sort of git ignore rule somewhere in your tree? |
Ok don't be dumb and set the |
@bradjc Can the pr/18 branch be deleted? |
201: Update Cargo.lock r=japaric a=Woyten Since #200, `Cargo.lock` is considered dirty after Xargo has been built. This is particularly annoying when using Xargo as a Git submodule such as in tock/libtock-rs#18. This PR updates `Cargo.lock` s.t. it will no longer be considered dirty after building Xargo.
This PR uses
lld
as the proposed linker forlibtock
. Usinglld
has a couple of advantages:arm-none-eabi-ld
as an external build tool.lld
, in contrast, is shipped with Rust (rust: Import LLD for linking wasm objects rust-lang/rust#48125) and, therefore, does not require any additional installation steps.lld
supports any target that LLVM supports.lld
is super fast.arm-none-eabi-ld
, such as the.bss
section. My guess is that proper relocation will be possible withlld
.Note: You might need to remove
$HOME/.xargo
before building anything.