Compilation error with float operations

62 views
Skip to first unread message

Susmita Nayak

unread,
May 8, 2024, 2:01:21 AMMay 8
to RISC-V SW Dev
Hi Team,

I am getting an error while running the RISCV GCC compiler command for the below code:

Screenshot 2024-05-08 at 11.29.03 AM.png

Command :

riscv32-unknown-elf-gcc  -march=rv32imafdc -mabi=ilp32f -lc -lgcc -o float_eg.elf float_eg.c


Error:

/opt/riscv_toolchain/riscv_tool_chain/bin/../lib/gcc/riscv32-unknown-elf/10.0.0/../../../../riscv32-unknown-elf/bin/ld: /tmp/ccpGGTuj.o: can't link single-float modules with soft-float modules

/opt/riscv_toolchain/riscv_tool_chain/bin/../lib/gcc/riscv32-unknown-elf/10.0.0/../../../../riscv32-unknown-elf/bin/ld: failed to merge target specific data of file /tmp/ccpGGTuj.o

collect2: error: ld returned 1 exit status


Please assist me in fixing the same.


Thanks,

Susmita



Brandon Cheo Fusi

unread,
May 9, 2024, 11:04:42 AMMay 9
to Susmita Nayak, RISC-V SW Dev
Hi Susmita,


Your toolchain seems to have been built with a soft float ABI i.e '--with-abi=ilp32'. Compile with
'float_eg.c' with '-march=rv32imac -mabi=ilp32' or built an appropriate toolchain.

--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/43c8fb7e-ec54-4e14-93df-69fd37b3b3fcn%40groups.riscv.org.

Susmita Nayak

unread,
May 10, 2024, 12:07:17 AMMay 10
to Brandon Cheo Fusi, RISC-V SW Dev
Thank you all.
Got it.

Best Regards,
Susmita Nayak 
Principal Engineer


Reply all
Reply to author
Forward
0 new messages