[PATCH] D129824: [RISCV] Set triple based on -march flag which can be deduced in more generic way
Kito Cheng via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 4 09:15:12 PDT 2022
kito-cheng added a comment.
Just realized the problem is trying to fixed the default value of `-mabi=`, currently `clang -target riscv32-elf -march=rv64gc -mabi=lp64d`/`riscv32-elf-clang -march=rv64gc -mabi=lp64d` is work, and match the behavior of GCC did, `riscv32-elf-gcc -march=rv64gc -mabi=lp64d`.
And this patch is trying to make following two command work: `clang -target riscv32-elf -march=rv64gc`/`riscv32-elf-clang -march=rv64gc`, specify `-march` and `-target` but no `-mabi`.
That is different story now, GCC isn't deduce the default abi from either target triple or abi, so if you invoke gcc with `riscv32-elf-gcc -march=rv64gc` or `riscv64-elf-gcc -march=rv32gc`, you will got error message like that: `cc1: error: ABI requires '-march=rv32'` or `cc1: error: ABI requires '-march=rv64'`.
So that's not compatible issue with GCC, that's sort of clang driver specify issue, and I don't have strong opinion on this.
As a GNU toolchain developer, I would say, we are not intend to change the behavior of default value of `-mabi` or `-march`, the consensus among RISC-V GNU toolchain maintainer is user should explicitly specify the `-march` and `-mabi` if you are not using default `-march` and `-mabi`.
CHANGES SINCE LAST ACTION
More information about the cfe-commits