[clang] [Driver] Mark -arch as TargetSpecific (PR #74365)

Daniil Kovalev via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 16:18:14 PST 2023


kovdan01 wrote:

@MaskRay Unfortunately, the case I was initially trying to fix still has a problem after applying this patch. Consider `LLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-musl`. In such a case, running `clang -arch arm64e -c test.c -###` will show us `"-triple" "aarch64-unknown-linux-musl"`. As far as I understood from the comment https://github.com/llvm/llvm-project/pull/72821#issuecomment-1839435929, a warning `-Wunused-command-line-argument` should be emitted - but it is not (this does not change even if we really compile to the object file instead of just printing cli args with `-###`).

Are we supposed to pass `-target` to clang in addition to `-arch` if we want to be sure to compile with Apple's triple? It might be reasonable, but in such case many tests which use `-arch` without `-target` actually might run with undesired non-Apple triple - I find such behavior a bit misleading. Is this "by design"?

https://github.com/llvm/llvm-project/pull/74365


More information about the cfe-commits mailing list