[PATCH] D129824: [RISCV] Set triple based on -march flag which can be deduced in more generic way

Wang Pengcheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 4 20:17:50 PDT 2022


pcwang-thead added a comment.

In D129824#3699911 <https://reviews.llvm.org/D129824#3699911>, @kito-cheng wrote:

> 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`.

@kito-cheng Thanks! We have noticed these differences between GNU and LLVM, and we have done some efforts to make both compatible.
I think we can discuss here: https://github.com/riscv-non-isa/riscv-toolchain-conventions/issues/20


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129824/new/

https://reviews.llvm.org/D129824



More information about the cfe-commits mailing list