Skip to content

riscv rt linker issue with cargo build #260

Closed
@yashwanthsinghm

Description

@yashwanthsinghm

We have used riscv_rt in our current projects and encountered a couple of issues:

Cargo release builds are happening but when we compile for debug its giving following error.

  • Linker Issue:  ``` rust-lld: error: <internal»:(.eh_frame+0x40): relocation R_RISCV_32_PCREL out of range: 2147486966 is not in I-2147483648, 2147483 6471; references ```
    

github : Strange21/RISCV: software for RISCV

In-order to reproduce the error

  1. cd riscv-hal
  2. cargo build --example gptimer

Issue

error: linking with 'rust-lld' failed: exit status: 1
= note: "rust-lld" "-flavor" "gnu" "/var/folders/bn/73c2thl17734d902lypvxbpc0000gn/T/rustcf4Z0vW/symbols.0" "<2 object files omitted»" "-
-as-needed" "-Bstatic" "/Users/IKL2KOR/Desktop/shakti_riscv_hal/examples/gpio_applns/target/riscv64imac-unknown-none-elf/debug/deps/{libshak ti_riscy_hal-e9fb2d117581f3a1. rlib, libtock_registers-dd0b6693e8c40f2b.rlib, libriscv_rt-a141fe7383d82ded. rib, libriscv-bc6c60484b95b10b.rlib,
libcritical_section-e493a1cc7896740d. rlib, libriscv_pac-a4f795429843822a. rlib, libembedded_hal-ab4e22761e14a865.rlib}.rlib" "<sysroot>/lib/rus
tlib/riscv64imac-unknown-none-elf/lib/{librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Bdynamic" "-z".
"noexecstack"
"-L" "/Users/IKL2KOR/Desktop/shakti_riscv_hal/examples/gpio_applns/target/riscv64imac-unknown-none-elf/debug/build/riscv-rt-5a95d4c5a1c18589 /out" "-L" "/Users/IKL2KOR/Desktop/shakti_riscv_hal/examples/gpio_applns/target/riscv64imac-unknown-none-elf/debug/build/shakti_riscv_hal-8e
= note: rust-lld: error: «internal»: (-eh_frame+0x1c): relocation R_RISCV_32_PCREL out of range: 2147486584 is not in I-2147483648, 2147483
6471; references '.LO '
»> defined in /Users/IKL2KOR/. rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore
-9699b3174c9bc206. rlib(core-9699b3174c9bc206, core. c4f5009eca0c9ae-cgu.0.rcgu.o)
rust-lld: error: <internal»:(.eh_frame+0x40): relocation R_RISCV_32_PCREL out of range: 2147486966 is not in I-2147483648, 2147483
6471; references
»> defined in /Users/IKL2KOR/. rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore
-9699b3174c9bc206. rlib(core-9699b3174c9bc206. core. [email protected])
rust-lld: error: <internal>: (.eh_frame+0x64): relocation R_RISCV_32_PCREL out of range: 2147487738 is not in I-2147483648, 2147483
647]; references 'LO '
»> defined in /Users/IKL2KOR/. rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore
-9699b3174c9bc206. rlib(core-9699b3174c9bc206.core.c4f5009ecac9ae-cgu.0.rcgu.o)
rust-lld: error: «internal>: (.eh_frame+0x84): relocation R_RISCV_32_PCREL out of range: 2147487736 is not in I-2147483648, 2147483
6471; references
'.LO'
»> defined in /Users/IKLKOR/. rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore
-9699b3174c9bc206. rlib(core-9699b3174c9bc206. core. [email protected])
rust-lld: error: ‹internal>: (.eh_frame+0xa4): relocation R_RISCV_32_PCREL out of range: 2147487738 is not in I-2147483648, 2147483
6471; references
'LO'
›>› defined in /Users/IKL2KOR/. rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore
-9699b3174c9bc206. rlib(core-9699b3174c9bc206. core. c4f5009eca0c9aбe-cgu.0.rcgu.o)
rust-lld: error: «internal»:(.eh_frame+0xc4): relocation R_RISCV_32_PCREL out of range: 2147487782 is not in I-2147483648, 2147483
647]; references '.LO '
»› defined in /Users/IKLKOR/. rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore
-9699b3174c9bc206. rlib(core-9699b3174c9bc206. core. [email protected])
rust-lld: error: internal»: (.eh_frame+0xe4): relocation R_RISCV_32_PCREL out of range: 2147487808 is not in I-2147483648, 2147483
647]; references 'LO '
›>› defined in /Users/IKL2KOR/. rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/riscv64imac-unknown-none-elf/lib/libcore
-9699b3174c9bc206. rlib(core-9699b3174c9bc206. core. c4f5009eca0c9a6e-cgu.0.rcgu.o)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions