This is an archive of the discontinued LLVM Phabricator instance.

support: fix getProcessTriple in universal builds
ClosedPublic

Authored by jroelofs on Nov 21 2022, 9:50 AM.

Details

Summary

The bug happens when you build e.g. an x64_64;arm64 JIT with LLVM_HOST_TRIPLE=x86_64-apple-macos, and then run it on an apple-m1 not under Rosetta. In that case, sys::getProcessTriple() will return an x86_64 triple, not an arm64 one.

Diff Detail

Event Timeline

jroelofs created this revision.Nov 21 2022, 9:50 AM
jroelofs requested review of this revision.Nov 21 2022, 9:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 9:50 AM
keith added a comment.Nov 28 2022, 5:12 PM

I'm not super familiar with the history behind LLVM_HOST_TRIPLE, but one thing that definitely worries me about this specific change is there are other consumers of that variable, but only this 1 gets this fixup. I feel like the core issue is the mismatch between having a single LLVM_HOST_TRIPLE, but having cmake build a fat binary.

AFAICT, this is the only one where it really matters, aside from (plausibly) the one in ToolChain::isCrossCompiling().

keith accepted this revision.Dec 2 2022, 1:02 PM

It feels to me like we're defeating the purpose of LLVM_HOST_TRIPLE, but I imagine any other solution to this would require a much bigger hammer, so seems worth a try.

This revision is now accepted and ready to land.Dec 2 2022, 1:02 PM
This revision was landed with ongoing or failed builds.Jul 14 2023, 1:45 PM
This revision was automatically updated to reflect the committed changes.