Closed galak closed 3 years ago
In generally, R_RISCV_HI20 and R_RISCV_LO12_I/S pattern can only cover the absolute 32-bit address in the rv64 toolchain (since the signed extension, so the range will be a little bit hard to calculate).
I believe this is the code model issue. You can try to set the gcc option "-mcmodel=medany" first, and see if the problem is resolved or not. The medany model will use pc-relative relocation to access the symbols rather then use the absolutely access. Therefore, the access range should be more flexible.
@Nelson1225 the test is already setting -mcmodel=medany
and running into this issue. Using an older toolchain doesn't have issues building & linking the code.
Looks like the C library wasn’t compiled with -mcmodel=medany.
On Tue, Sep 15, 2020 at 4:36 AM Kumar Gala notifications@github.com wrote:
@Nelson1225 https://github.com/Nelson1225 the test is already setting -mcmodel=medany and running into this issue. Using an older toolchain doesn't have issues building & linking the code.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/riscv/riscv-binutils-gdb/issues/232#issuecomment-692658113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH3XQTUSHKUZHJHVBTTFRDSF5GVPANCNFSM4RMB7QCQ .
Looks like the C library wasn’t compiled with -mcmodel=medany.
Curious if something has changed that requires this now. Had a toolchain based on gcc-9.x and binutils-2.32 that didn't require this.
Curious if something has changed that requires this now. Had a toolchain based on gcc-9.x and binutils-2.32 that didn't require this.
Would also appreciate @kito-cheng and @jim-wilson feelings on this as we don't seem to default -mcmodel=medany
in riscv-gnu-toolchain
There is no single way to build a toolchain that is correct for everyone. So the defaults will always be wrong no matter what the defaults are. I think arguing about default values is pointless.
SiFive builds its embedded toolchains with -mcmodel=medany and --enable-multilib, but that isn't correct for everyone.
Nothing has changed in the toolchain. Perhaps something changed in zephy, or perhaps your zephyr target changed, since whether medlow works depends on your hardware target.
Hmm, the hardware target is qemu and the configuration w/regards to memory, etc hasn't changed.
Is it possible that newlib build with medlow
and zephyr build with medany
be an issue now?
When building test app for riscv64 in Zephyr:
tests/application_development/libcxx
I get the following, this is use master branch of riscv-toolchain.