Open DavidSpickett opened 6 months ago
@llvm/issue-subscribers-backend-risc-v
Author: David Spickett (DavidSpickett)
Thanks David, agreed this is potentially confusing. The logic that made -march
override --target
was added in https://reviews.llvm.org/D54214.
Options seem to be:
-march
overrides --target
, as is the case for some other combinations of command line flags.-target
was provided on the command line and -march is a different XLEN to it-target
was provided on the command line and -march
had a different XLEN to it.What do people think? CC @simonpcook as original patch author.
EDIT: Though the other configuration is how this interacts with however clang gets the target triple. e.g. if it's taken from a prefix on the binary name, then it arguably should be acceptable to override with -march
. This matches what i can do with my distro-install riscv64-*-gcc
toolchains, when I want to emit at least assembly for rv32 to check something.
The following does not error or warn:
And it produces code according to the value of
-march
:The opposite also works:
I assume I have to pick one of
-target riscv32
and-target riscv64
because if I use-target riscv
I get:Which itself is a bit unclear because I'm not sure
riscv
is even a valid target to begin with, but this is not RISC-V specific: