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

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 15:05:06 PDT 2021


jrtc27 added a comment.

In D110186#3013711 <https://reviews.llvm.org/D110186#3013711>, @MaskRay wrote:

> 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, perhaps the former for brevity.

So, the _triple_ is always exactly what I said. But if that's a nonsensical triple, such as sparcv9-apple-darwin20.3.0, then yes things can get weird and it may end up falling back on ELF until suddenly that case gets implemented properly.


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