riscv-software-src / riscv-software-src/opensbi
u54 opensbi does not compile with -Os flag
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 712
- PR merge metrics
- No merged PRs in 30d
Description
I've changed this line to:
platform-cflags-y = -Os
Then, when I try to compile for the u54 board, I get the following error:
riscv64-unknown-elf/bin/ld: build/opensbi/platform/sifive/fu540/lib/libplatsbi.a(riscv_asm.o): in function `misa_string':
lib/sbi/riscv_asm.c:55: undefined reference to `memcpy'
collect2: error: ld returned 1 exit status
make: *** [platform/sifive/fu540/firmware/fw_dynamic.elf] Error 1
Any idea what could be causing this? I'm compiling for 64-bit riscv and using gcc 10.2.0. Note that this works with the other standard o flags like -O1 and -O3.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with platform/sifive/fu540/config.mk at the linked platform-cflags-y setting and lib/sbi/riscv_asm.c:55, then reproduce the u54 64-bit build using GCC 10.2.0 with -Os. Trace why the -Os build references memcpy while -O1 and -O3 link successfully; done means the u54 build completes with -Os without the undefined reference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100