Skip to content

[flang]When flang-new compiles for the RISC-V platform, the object files have an incorrect ABI. #115679

@buggfg

Description

@buggfg

I am cross-compiling the SPEC CPU2006 benchmarks using the LLVM 19.1.0 compiler on an Intel machine. The C/C++ examples can be successfully built into executable files using runspec and run successfully on the** RISC-V** platform. However, for Fortran examples like 410.bwaves, building with flang-new fails, and the error is:

ld.lld: error: bwaves.lto.o: cannot link object files with different floating-point ABI from ~/gnu-riscv64-20241106/sysroot/usr/lib/crt1.o.

PS. config info
**FOPTIMIZE **= -march=rv64gcv_zba_zbb_zbc_zbs -O3 -static -flto -ffast-math
**EXTRA_LDFLAGS **= -fuse-ld==ld.lld -L${gnu-riscv64}/lib/

Through debugging, I found that the ABI of bwaves.lto.o is rv64i2p1, while the ABI of the library file crt1.o is rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zmmul1p0. Clearly, bwaves.lto.o is generated incorrectly. Could you please advise me on how to resolve this issue? Thank you very much!

The complete run script is:
$ flang-new --target=riscv64-unknown-linux-gnu --gcc-toolchain={RISCV} --sysroot={RISCV}/sysroot -c -o block_solver.o -march=rv64gcv_zba_zbb_zbc_zbs -O3 -static -flto -ffast-math -DSPEC_CPU_LP64 -DSPEC_LP64 block_solver.f
$ flang-new --target=riscv64-unknown-linux-gnu --gcc-toolchain={RISCV} --sysroot={RISCV}/sysroot -c -o flow_lam.o -march=rv64gcv_zba_zbb_zbc_zbs -O3 -static -flto -ffast-math -DSPEC_CPU_LP64 -DSPEC_LP64 flow_lam.f
$ flang-new --target=riscv64-unknown-linux-gnu --gcc-toolchain={RISCV} --sysroot={RISCV}/sysroot -c -o flux_lam.o -march=rv64gcv_zba_zbb_zbc_zbs -O3 -static -flto -ffast-math -DSPEC_CPU_LP64 -DSPEC_LP64 flux_lam.f
$ flang-new --target=riscv64-unknown-linux-gnu --gcc-toolchain={RISCV} --sysroot={RISCV}/sysroot -c -o jacobian_lam.o -march=rv64gcv_zba_zbb_zbc_zbs -O3 -static -flto -ffast-math -DSPEC_CPU_LP64 -DSPEC_LP64 jacobian_lam.f
$ flang-new --target=riscv64-unknown-linux-gnu --gcc-toolchain={RISCV} --sysroot={RISCV}/sysroot -c -o shell_lam.o -march=rv64gcv_zba_zbb_zbc_zbs -O3 -static -flto -ffast-math -DSPEC_CPU_LP64 -DSPEC_LP64 shell_lam.f
$ flang-new --target=riscv64-unknown-linux-gnu --gcc-toolchain={RISCV} --sysroot={RISCV}/sysroot -march=rv64gcv_zba_zbb_zbc_zbs -O3 -static -flto -ffast-math -DSPEC_CPU_LP64 -fuse-ld=ld.lld -L{RISCV}/lib/ block_solver.o flow_lam.o flux_lam.o jacobian_lam.o shell_lam.o -o bwaves

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions