[PATCH] D110186: Fix tests defaulting to incorrect triples on AIX

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 14:56:46 PDT 2021


MaskRay added a comment.

In D110186#3013551 <https://reviews.llvm.org/D110186#3013551>, @jrtc27 wrote:

> In D110186#3013531 <https://reviews.llvm.org/D110186#3013531>, @MaskRay wrote:
>
>>> The tests only specify -march, so when the tests are run on AIX the target OS defaults to AIX, which causes the tests to misbehave.
>>
>> Can you confirm? I don't think so.
>>
>> See `llvm/lib/Support/Triple.cpp:getDefaultFormat`. ELF is the default binary format for everything except wasm.
>> This does give ELF a privilege but that is just how things work:)
>
> -march is defined to be "the native triple with the CPU replaced with the argument" and has caused problems in the past. It's not the same as -mtriple where there are defaults that don't depend on the native triple.

Looks like `-march` may be a bit misleading due to `llvm/lib/Support/Triple.cpp:getDefaultFormat` returning ELF for many machines.

For example, on arm64 macOS, `TheTarget->createTargetMachine` takes a `sparcv9-apple-darwin20.3.0` triple while the binary format is ELF since Darwin doesn't support sparcv9.

I think switching to `-mtriple=` makes sense to me. Either `-mtriple=sparc9` or `-mtriple=sparc9-unknown-elf` works for me, but the former for brevity.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110186



More information about the llvm-commits mailing list