Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Merge #260
Browse files Browse the repository at this point in the history
260: Update linker script to fix arm-none-eabi-gcc linking. Closes #259 r=korken89 a=adamgreig



Co-authored-by: Adam Greig <adam@adamgreig.com>
  • Loading branch information
bors[bot] and adamgreig authored Apr 3, 2020
2 parents 5ef4491 + b0ea68f commit 2a7624f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ main() {
cargo rustc --target "$TARGET" --example device --features device --release -- \
-C linker=arm-none-eabi-ld

# linking with GNU GCC
for ex in "${examples[@]}"; do
cargo rustc --target "$TARGET" --example "$ex" -- \
-C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles

cargo rustc --target "$TARGET" --example "$ex" --release -- \
-C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles
done
for ex in "${fail_examples[@]}"; do
! cargo rustc --target "$TARGET" --example "$ex" -- \
-C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles

! cargo rustc --target "$TARGET" --example "$ex" --release -- \
-C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles
done

cargo rustc --target "$TARGET" --example device --features device -- \
-C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles

cargo rustc --target "$TARGET" --example device --features device --release -- \
-C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles

# linking with rustc's LLD
for ex in "${examples[@]}"; do
cargo rustc --target "$TARGET" --example "$ex"
Expand All @@ -77,6 +99,10 @@ main() {
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target "$TARGET" --example qemu | grep "x = 42"
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target "$TARGET" --example qemu --release | grep "x = 42"

# linking with GNU GCC
env RUSTFLAGS="-C linker=arm-none-eabi-gcc -C link-arg=-Tlink.x -Clink-arg=-nostartfiles" cargo run --target "$TARGET" --example qemu | grep "x = 42"
env RUSTFLAGS="-C linker=arm-none-eabi-gcc -C link-arg=-Tlink.x -Clink-arg=-nostartfiles" cargo run --target "$TARGET" --example qemu --release | grep "x = 42"

# linking with rustc's LLD
cargo run --target "$TARGET" --example qemu | grep "x = 42"
cargo run --target "$TARGET" --example qemu --release | grep "x = 42"
Expand Down
2 changes: 1 addition & 1 deletion link.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ SECTIONS
} > FLASH

/* ### .rodata */
.rodata __etext : ALIGN(4)
.rodata : ALIGN(4)
{
*(.rodata .rodata.*);

Expand Down

0 comments on commit 2a7624f

Please sign in to comment.