Clone the project down and try to compile, I expected to see it compiles normally. However there is a strange error:
❯ cargo build
Compiling runtime-test v0.1.0 (/Users/mac/2020/RustProjects/runtime-test)
error: linking with `rust-lld` failed: exit code: 1
|
= note: "rust-lld" "-flavor" "gnu" "--eh-frame-hdr" "-L" /* ... many rlib files ... */ "-Tmemory.x" "-Tlink.x" "-Bdynamic"
= note: rust-lld: error: .. /runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-7ea7a4b3a0900dbe.rlib(riscv-rt.o):(.eh_frame): PC offset is too large: 0x80000018
error: aborting due to previous error
error: could not compile `runtime-test`.
To learn more, run the command again with --verbose.
I've uploaded full error message into ubuntu pastebin: https://paste.ubuntu.com/p/jdmhvmy3WS/. It shows that the linking process has some error like (.eh_frame): PC offset is too large: 0x80000018.
It's very strange. I configure the memory settings in memory.x. When SRAM base is 0x80000000, the error occurres. But when I set it to a slightly bigger value like 0x80000134, or sligntly smaller 0x7fffffe0, it compiles normally without any errors.
My target (embedded) platform has memory located exactly in 0x80000000 where I must flash my program into.
What could be the problem?
Edit: I tried on latest stable rustc 1.45.0 (5c1f21c3b 2020-07-13), it compiles normally and the error does not occur again.
To illustrate this problem, I have minimized the code: https://github.com/luojia65/runtime-test. This project depends on riscv-rt crate 0.8.0.
Clone the project down and try to compile, I expected to see it compiles normally. However there is a strange error:
I've uploaded full error message into ubuntu pastebin: https://paste.ubuntu.com/p/jdmhvmy3WS/. It shows that the linking process has some error like (.eh_frame): PC offset is too large: 0x80000018.
It's very strange. I configure the memory settings in memory.x. When SRAM base is 0x80000000, the error occurres. But when I set it to a slightly bigger value like 0x80000134, or sligntly smaller 0x7fffffe0, it compiles normally without any errors.
My target (embedded) platform has memory located exactly in 0x80000000 where I must flash my program into.
What could be the problem?
Edit: I tried on latest stable
rustc 1.45.0 (5c1f21c3b 2020-07-13)
, it compiles normally and the error does not occur again.Meta
rustc --version --verbose
:My stable's
rustc --version --verbose
:`cargo build --verbose`
``` ❯ cargo build --verbose Fresh lazy_static v1.4.0 Fresh regex-syntax v0.6.18 Fresh semver-parser v0.7.0 Fresh unicode-xid v0.1.0 Fresh rand_core v0.4.2 Fresh bit_field v0.10.0 Fresh r0 v1.0.0 Compiling runtime-test v0.1.0 (/Users/mac/2020/RustProjects/runtime-test) Running `rustc --crate-name build_script_build --edition=2018 build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=8291cbab5b6d7992 -C extra-filename=-8291cbab5b6d7992 --out-dir /Users/mac/2020/RustProjects/runtime-test/target/debug/build/runtime-test-8291cbab5b6d7992 -C incremental=/Users/mac/2020/RustProjects/runtime-test/target/debug/incremental -L dependency=/Users/mac/2020/RustProjects/runtime-test/target/debug/deps` Fresh thread_local v1.0.1 Fresh semver v0.9.0 Fresh rand_core v0.3.1 Fresh rustc_version v0.2.3 Fresh rand v0.5.6 Fresh proc-macro2 v0.4.30 Fresh memchr v2.3.3 Fresh quote v0.6.13 Fresh aho-corasick v0.7.13 Fresh syn v0.15.44 Fresh regex v1.3.9 Fresh riscv-target v0.1.2 Fresh bare-metal v0.2.5 Fresh riscv-rt-macros v0.1.6 Fresh riscv v0.6.0 Fresh riscv-rt v0.8.0 Running `/Users/mac/2020/RustProjects/runtime-test/target/debug/build/runtime-test-8291cbab5b6d7992/build-script-build` Running `rustc --crate-name runtime_test --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=be5e44c8ddeac7cc -C extra-filename=-be5e44c8ddeac7cc --out-dir /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps --target riscv64imac-unknown-none-elf -C incremental=/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/incremental -L dependency=/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps -L dependency=/Users/mac/2020/RustProjects/runtime-test/target/debug/deps --extern riscv_rt=/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-7ea7a4b3a0900dbe.rlib -C link-arg=-Tmemory.x -C link-arg=-Tlink.x -L /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/runtime-test-7effb8a5c1ae85fc/out -L /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-rt-89827235546695ae/out -L /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-rt-89827235546695ae/out -L /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-66332674181ce1ed/out` error: linking with `rust-lld` failed: exit code: 1 | = note: "rust-lld" "-flavor" "gnu" "--eh-frame-hdr" "-L" "/Users/mac/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/runtime_test-be5e44c8ddeac7cc.5904ri43xt2mrhjm.rcgu.o" "-o" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/runtime_test-be5e44c8ddeac7cc" "--gc-sections" "-L" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps" "-L" "/Users/mac/2020/RustProjects/runtime-test/target/debug/deps" "-L" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/runtime-test-7effb8a5c1ae85fc/out" "-L" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-rt-89827235546695ae/out" "-L" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-rt-89827235546695ae/out" "-L" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-66332674181ce1ed/out" "-L" "/Users/mac/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib" "-Bstatic" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-7ea7a4b3a0900dbe.rlib" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libriscv-aaf1924c4d23cdd9.rlib" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libbit_field-e176a93850a57144.rlib" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libbare_metal-bbaa822c72da25c9.rlib" "/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libr0-406f343862937fa8.rlib" "/Users/mac/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/librustc_std_workspace_core-28816ddbd527c2d7.rlib" "/Users/mac/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore-af7fd6dae6d1be55.rlib" "/Users/mac/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcompiler_builtins-65c2e59034282182.rlib" "-Tmemory.x" "-Tlink.x" "-Bdynamic" = note: rust-lld: error: /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-7ea7a4b3a0900dbe.rlib(riscv-rt.o):(.eh_frame): PC offset is too large: 0x80000018 error: aborting due to previous error error: could not compile `runtime-test`. Caused by: process didn't exit successfully: `rustc --crate-name runtime_test --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=be5e44c8ddeac7cc -C extra-filename=-be5e44c8ddeac7cc --out-dir /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps --target riscv64imac-unknown-none-elf -C incremental=/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/incremental -L dependency=/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps -L dependency=/Users/mac/2020/RustProjects/runtime-test/target/debug/deps --extern riscv_rt=/Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/deps/libriscv_rt-7ea7a4b3a0900dbe.rlib -C link-arg=-Tmemory.x -C link-arg=-Tlink.x -L /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/runtime-test-7effb8a5c1ae85fc/out -L /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-rt-89827235546695ae/out -L /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-rt-89827235546695ae/out -L /Users/mac/2020/RustProjects/runtime-test/target/riscv64imac-unknown-none-elf/debug/build/riscv-66332674181ce1ed/out` (exit code: 1) ```