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

compile failure for qemu platform while success for spike platform #17

Open
robert-hz opened this issue Feb 20, 2024 · 1 comment
Open

Comments

@robert-hz
Copy link

robert-hz commented Feb 20, 2024

Hi, I've tried to compile this unit test bin with riscv gnu toolchain, configured as:

./configure --prefix=/opt/riscv-new --disable-multilib --with-cmodel=medany --with-arch=rv64imafdc_zicsr --with-abi=lp64d

meanwhile, modify this bin's Makefile as below, in order to avoid soft float issure reported in #14

 ifdef GCCVERSION
-       GENERIC_FLAGS += -march=rv64imac_zicsr
+       GENERIC_FLAGS += -march=rv64imafdc_zicsr
 else
-       GENERIC_FLAGS += -march=rv64imac
+       GENERIC_FLAGS += -march=rv64imafdc
 endif
-GENERIC_FLAGS += -mabi=lp64 -g3 -mcmodel=medany -O3 $(inc_dirs)
+GENERIC_FLAGS += -mabi=lp64d -g3 -mcmodel=medany -O3 $(inc_dirs)
 
 ASFLAGS = $(GENERIC_FLAGS)
 CFLAGS = $(GENERIC_FLAGS)

But link error:

/opt/riscv-new/lib/gcc/riscv64-unknown-linux-gnu/13.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: /opt/riscv-new/sysroot/usr/lib/libc.a(dl-support.o): in function `_dl_aux_init':
dl-support.c:(.text+0x3c): undefined reference to `_start'
/opt/riscv-new/lib/gcc/riscv64-unknown-linux-gnu/13.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: dl-support.c:(.text+0xb8): undefined reference to `__ehdr_start'
/opt/riscv-new/lib/gcc/riscv64-unknown-linux-gnu/13.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: build/qemu/rvh_test.elf: hidden symbol `_start' isn't defined
/opt/riscv-new/lib/gcc/riscv64-unknown-linux-gnu/13.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: final link failed: bad value

While compile platform=spike succeeds.

@Du-Chao
Copy link

Du-Chao commented Apr 11, 2024

I think you should use a 'riscv64-unknown-elf-' toolchain, instead of the 'riscv64-unknown-linux-gnu' toolchain.

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

2 participants