riscv / riscv-test-env

https://jira.riscv.org/browse/RVG-141
Other
42 stars 107 forks source link

fix a building error #24

Closed wuzhy closed 4 years ago

wuzhy commented 4 years ago

riscv64-unknown-elf-gcc -march=rv32g -mabi=ilp32 -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -DENTROPY=0xf7930f7 -std=gnu99 -O2 -I/data/riscv/riscv-tools/riscv-tests/isa/../env/v -I/data/riscv/riscv-tools/riscv-tests/isa/macros/scalar -T/data/riscv/riscv-tools/riscv-tests/isa/../env/v/link.ld /data/riscv/riscv-tools/riscv-tests/isa/../env/v/entry.S /data/riscv/riscv-tools/riscv-tests/isa/../env/v/*.c rv32ui/simple.S -o rv32ui-v-simple /opt/riscv/lib/gcc/riscv64-unknown-elf/10.1.0/../../../../riscv64-unknown-elf/bin/ld: /tmp/cc8oFAkO.o: in function tohost': (.tohost+0x0): multiple definition oftohost'; /tmp/ccOTKaAa.o:(.sbss+0x10): first defined here /opt/riscv/lib/gcc/riscv64-unknown-elf/10.1.0/../../../../riscv64-unknown-elf/bin/ld: /tmp/cc8oFAkO.o: in function fromhost': (.tohost+0x40): multiple definition offromhost'; /tmp/ccOTKaAa.o:(.sbss+0x8): first defined here collect2: error: ld returned 1 exit status /data/riscv/riscv-tools/riscv-tests/isa/Makefile:74: recipe for target 'rv32ui-v-simple' failed make[1]: [rv32ui-v-simple] Error 1 make[1]: Leaving directory '/data/riscv/riscv-tools/riscv-tests/isa' Makefile:28: recipe for target 'isa' failed make: [isa] Error 2

Signed-off-by: Zhi Yong Wu zhiyong.wu@sophgo.com

aswaterman commented 4 years ago

I’m surprised I haven’t seen this error.

What’s the other translation unit where to host and fromhost are defined?

aswaterman commented 4 years ago

I see - this is because recent versions of GCC changed the default to -fno-common. It also happens on older versions of GCC if you explicitly pass that flag. Thanks for the fix.