Skip to content
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

[help]: relocation truncated to fit: R_RISCV_HI20 against `$databegin', collect2: error: ld returned 1 exit status #63

Open
ztjjj9 opened this issue Apr 26, 2024 · 2 comments
Assignees

Comments

@ztjjj9
Copy link

ztjjj9 commented Apr 26, 2024

Help

  1. 编译命令:

k230_sdk/toolchain/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-as -o rv_log.S.o -c -march=rv64imafdcv -mabi=lp64d rv_log.S
k230_sdk/toolchain/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-gcc -o rv_test.o -c -mcmodel=medany -march=rv64imafdcv -mabi=lp64d rv_test.c
k230_sdk/toolchain/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-gcc -o rv_log.elf -mcmodel=medany -march=rv64imafdcv -mabi=lp64d -T k230_sdk/src/big/mpp/userapps/sample/linker_scripts/riscv64/link.lds -Lk230_sdk/src/big/rt-smart/userapps/sdk/rt-thread/lib -Wl,--whole-archive -lrtthread -Wl,--no-whole-archive -n --static rv_log.S.o rv_test.o -Lk230_sdk/src/big/rt-smart/userapps/sdk/lib/risc-v/rv64 -Lk230_sdk/src/big/rt-smart/userapps/sdk/rt-thread/lib/risc-v/rv64 -Wl,--start-group -lrtthread -Wl,--end-group

  1. 第三步编译报错误:

rv_log.S.o:(.text+0x12): relocation truncated to fit: R_RISCV_HI20 against $databegin'
collect2: error: ld returned 1 exit status`
代码已上传,麻烦看一下吧,谢谢!
code.zip

@LearnigF
Copy link

LearnigF commented Jul 26, 2024

建议使用如下指令访问符号
image

@ztjjj9
Copy link
Author

ztjjj9 commented Aug 21, 2024

谢谢您的回答!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants