aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/ci/script.sh
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2018-08-07 14:43:28 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2018-08-07 15:22:39 -0500
commitf2c5e2e4058b0a57a1d874878bde67f612b2d9dd (patch)
treeba2164706a20c1fac83a9118753cd81302724402 /cortex-m-rt/ci/script.sh
parent6e5e5ea4597ec6634f5d730b3218f8b71156da40 (diff)
downloadcortex-m-f2c5e2e4058b0a57a1d874878bde67f612b2d9dd.tar.gz
cortex-m-f2c5e2e4058b0a57a1d874878bde67f612b2d9dd.tar.zst
cortex-m-f2c5e2e4058b0a57a1d874878bde67f612b2d9dd.zip
refactor the linker script
to make it more compatible with LLD. This commit contains no functional changes. fixes #70 Overview of changes: - Alignment checks are enabled now that rust-lld (LLD 7.0) supports the modulo operator. - Removed some private symbols (e.g. __foo) in favor of ADDR and SIZEOF. - Turned .got into a NOLOAD section now that rust-lld supports it. - Replaced `ABSOLUTE(.)` with `.` as an old LLD overlap bug seems to be gone and ABSOLUTE seems to cause problems, like #70, on bigger programs. - Made the linker assertion messages more uniform. - Extended test suite to check that linking works with both rust-lld and GNU LD.
Diffstat (limited to 'cortex-m-rt/ci/script.sh')
-rw-r--r--cortex-m-rt/ci/script.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/cortex-m-rt/ci/script.sh b/cortex-m-rt/ci/script.sh
index 221386d..2515b8f 100644
--- a/cortex-m-rt/ci/script.sh
+++ b/cortex-m-rt/ci/script.sh
@@ -6,11 +6,13 @@ main() {
cargo check --target $TARGET --features device
local examples=(
+ alignment
minimal
main
state
)
if [ $TRAVIS_RUST_VERSION = nightly ]; then
+ # linking with GNU LD
for ex in "${examples[@]}"; do
cargo rustc --target $TARGET --example $ex -- \
-C link-arg=-nostartfiles \
@@ -28,6 +30,29 @@ main() {
cargo rustc --target $TARGET --example device --features device --release -- \
-C link-arg=-nostartfiles \
-C link-arg=-Wl,-Tlink.x
+
+ # linking with rustc's LLD
+ for ex in "${examples[@]}"; do
+ cargo rustc --target $TARGET --example $ex -- \
+ -C linker=rust-lld \
+ -Z linker-flavor=ld.lld \
+ -C link-arg=-Tlink.x
+
+ cargo rustc --target $TARGET --example $ex --release -- \
+ -C linker=rust-lld \
+ -Z linker-flavor=ld.lld \
+ -C link-arg=-Tlink.x
+ done
+
+ cargo rustc --target $TARGET --example device --features device -- \
+ -C linker=rust-lld \
+ -Z linker-flavor=ld.lld \
+ -C link-arg=-Tlink.x
+
+ cargo rustc --target $TARGET --example device --features device --release -- \
+ -C linker=rust-lld \
+ -Z linker-flavor=ld.lld \
+ -C link-arg=-Tlink.x
fi
}