-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RISC-V linker fail, relocation truncated to fit: R_RISCV_HI20 #10594
Comments
Where you toolchain come from? This is a known issue for the new toolchain which lead #10306 was reverted. Could you spend time to fix it? |
My toolchain version is 12.2.0 comes from https://github.com/riscv-collab/riscv-gnu-toolchain. |
Since it's the same problem, you can fix the problem with your current environment. Once the fix is merged, I will bring back #10306 to ensure no new break happen in the future. |
Maybe we should build riscv toolchain from souce to match our requirement, by default the prebuilt toolchain use |
I find a post illustrate this problem and the key is jal by itself gives you only 20 bits, which means a +/-1MB range. Original linker script is
and their address show
After I modify linker script to
Their address are
But still failed. |
Could you please modify the linker script to become
also it would be good to add |
I think you can try to follow https://github.com/apache/nuttx/blob/master/boards/risc-v/c906/smartl-c906/scripts/ld.script as an example |
It still failed and the error message is same as before . |
I downloaded and installed the same toolchain and am able to reproduce an issue. I think the case is that toolchain is build without support of
I think the best would be to use toolchain from #10306 |
That is interesting. Could you please share map files with and without the issue? |
Sorry, I forgot I using arm toolchain to work instead of riscv now. |
I recommend to use a proper toolchain and close this issue. Basically we need toolchain to support |
I got it. Thanks your reply. |
If you do not need to compile C++ code then you can use the latest toolchain from https://github.com/sifive/freedom-tools/releases |
@pkarashchenko do you find the latest prebuilt toolchain from the well-known provider which support -mcmodel=medany? Otherwise, we can' fix C++ error reported from macOS: |
The issue here is that SiFive stopped the creation of prebuilt versions (not sure why, but still this is the fact) and all other places I found seem to be tailored to a specific use case. |
Yes, we need find a provider which build the toolchain with -mcmodel=medany, otherwise we can't:
Both are important and urgent to us, so let's reopen this issue to track the progress. |
Hi All: Wonder if the xPack GNU RISC-V Embedded GCC might fix this problem? https://xpack.github.io/dev-tools/riscv-none-elf-gcc/install/ I built NuttX for JH7110 (RISCV64, NuttX Kernel Mode) with the xPack Toolchain, and it boots OK on Star64 SBC. I haven't tested Math Functions yet: I'm exploring xPack as an alternative toolchain, since SiFive Freedom Tools won't run on Arm64 Linux (Raspberry Pi OS). I tried gcc-riscv64-unknown-elf on Arm64 Debian, but it doesn't include "math.h": https://lupyuen.github.io/articles/release#appendix-missing-mathh Update: xPack Toolchain works OK with Math Functions on JH7110: Source Code / Output Log / ELF Symbols |
xPack's toolchain may not fix this problem, I got its compile configurations by
The toolchain from Ubuntu/Debian may works since it compiled with
|
@lupyuen libm issue could be fixed by select from nuttx, newlib, libmcs and openlibm if toolchain doesn't provide one: |
@no1wudi I found this message under xPack v12.1.0.2, does it mean that https://xpack.github.io/blog/2022/05/18/riscv-none-elf-gcc-v12-1-0-2-released/#-mcmodelmedany
(Update: The message appears in all versions of xPack) It doesn't appear in the binary though:
|
Thanks for your notifacation, maybe we can consider to use xPack's toolchain for risc-v in CI. |
When I try to compile nuttx hash: f39de6f
config: rv-virt:smp64
tookchain: riscv64-unknown-elf-gcc (g2ee5e430018) 12.2.0
Does anyone meet this problem?
The text was updated successfully, but these errors were encountered: