Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Doesn't compile with the latest nightly toolchain. #102

Closed
Tnze opened this issue Aug 21, 2022 · 4 comments · Fixed by #103 or #105
Closed

Doesn't compile with the latest nightly toolchain. #102

Tnze opened this issue Aug 21, 2022 · 4 comments · Fixed by #103 or #105

Comments

@Tnze
Copy link

Tnze commented Aug 21, 2022

The project works fine before I update the toolchain today. And then it seems to be faild to linking now:
And I update the riscv-rt = "0.8.0" to the latest riscv-rt = "0.9", which still doesn't work.

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "C:\\Users\\Tnze\\AppData\\Local\\Temp\\rustcFQvI1O\\symbols.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.0.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.1.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.10.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.11.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.12.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.13.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.14.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.15.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.2.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.3.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.4.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.5.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.6.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.7.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.8.rcgu.o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1.the_gift.acb574d6-cgu.9.rcgu.o" "--as-needed" "-L" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps" "-L" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\release\\deps" "-L" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\build\\the-gift-fdb32f53c09e7cd1\\out" "-L" "C:\\Users\\Tnze\\Documents\\Projects\\Ey-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imac-unknown-none-elf\\lib\\librustc_std_workspace_core-47c3987b2c3217d4.rlib" "C:\\Users\\Tnze\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imac-unknown-none-elf\\lib\\libcore-5f51ee8cf12ea786.rlib" "C:\\Users\\Tnze\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imac-unknown-none-elf\\lib\\libcompiler_builtins-2ae83c8d0fb9bfcd.rlib" "-Bdynamic" "-znoexecstack" "-L" "C:\\Users\\Tnze\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imac-unknown-none-elf\\lib" "-o" "C:\\Users\\Tnze\\Documents\\Projects\\Embedded\\the-gift\\target\\riscv32imac-unknown-none-elf\\release\\deps\\the_gift-25721c29c540d9b1" "--gc-sections" "-O1" "-Tmemory-cb.x" "-Tlink.x"  = note: rust-lld: error: C:\Users\Tnze\Documents\Projects\Embedded\the-gift\target\riscv32imac-unknown-none-elf\release\build\riscv-rt-3ec61bb139669965\out\link.x:58: expected filename pattern          >>>     (*(.trap));          >>>     ^

warning: `the-gift` (bin "the-gift") generated 9 warningserror: could not compile `the-gift` due to previous error; 9 warnings emitted

The problem is occured here:

(*(.trap));

@Disasm
Copy link
Member

Disasm commented Aug 21, 2022

Hi! Could you post a minimal example somewhere which reveals the problem?

@yvt
Copy link

yvt commented Aug 21, 2022

I've been looking into this issue since a CI failure in my project. Here's a minimal reproducing example:

git clone https://github.com/riscv-rust/longan-nano.git
cd longan-nano
cat > rust-toolchain.toml <<EOF
[toolchain]
channel = "nightly-2022-08-13"  # earliest reproducing nightly
targets = ["riscv32imac-unknown-none-elf"]
EOF
cargo build --release --example blinky
...
  = note: rust-lld: error: /tmp/longan-nano/target/riscv32imac-unknown-none-elf/release/build/riscv-rt-b6ada1d0dd9918f5/out/link.x:58: expected filename pattern
          >>>     (*(.trap));
          >>>     ^

nightly-2022-08-13 upgraded LLVM to version 15 (rust-lang/rust#99464), which includes a bug fix in LLD (https://reviews.llvm.org/D125523) to handle this syntax as an error.

bors bot added a commit that referenced this issue Sep 8, 2022
103: Remove superfluous parentheses from link.x r=almindor a=jannic

Fixes #102

Co-authored-by: Jan Niehusmann <[email protected]>
@bors bors bot closed this as completed in c758d15 Sep 8, 2022
@Tnze
Copy link
Author

Tnze commented Sep 11, 2022

Thanks for the fix! A version should be published so we can update in our project's Cargo.toml

@adamgreig
Copy link
Member

This now affects the latest stable 1.65.0, so it might be worth publishing 0.9.1 with the fix?

bors bot added a commit that referenced this issue Nov 5, 2022
105: release v0.10.0 r=Disasm a=almindor

Release latest master as `v0.10.0` to fix #102 properly

Co-authored-by: Ales Katona <[email protected]>
taiki-e pushed a commit to taiki-e/riscv-rt that referenced this issue Dec 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants