This is an archive of the discontinued LLVM Phabricator instance.

Change getProcessTriple to return different archs in universal binary
Needs ReviewPublic

Authored by jpienaar on Dec 31 2022, 8:13 AM.

Details

Reviewers
lhames
Summary

With the current approach that cmake makes uses for universal binaries
getProcessTriple was returning the same value whether or not being run on
x86_64 or arm. This resulted in failures if one ran the tools/tests with
arch-x86_64 or arch -arm64 (depending on LLVM_HOST_TRIPLE that was set at build
time). Change getProcessTriple to consider the architecture being compiled when
populating triple.

I'm not sure if this is best approach but LLVM_HOST_TRIPLE is fixed per
compilation given current universal binary approach and this is noninvasive
while enabling usage inside universal binary so easy to change.

Diff Detail

Event Timeline

jpienaar created this revision.Dec 31 2022, 8:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 31 2022, 8:13 AM
jpienaar requested review of this revision.Dec 31 2022, 8:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 31 2022, 8:13 AM
jpienaar edited the summary of this revision. (Show Details)Jan 4 2023, 10:52 AM
jpienaar added a reviewer: lhames.
mehdi_amini added inline comments.
llvm/lib/Support/Host.cpp
1936

Is the test useful here?

jpienaar added inline comments.Feb 14 2023, 9:57 PM
llvm/lib/Support/Host.cpp
1936

I think so, my rationale was if there were subtarget set then I'd not be clobbering it here to just set same target.

lhames added a subscriber: jroelofs.Aug 6 2023, 1:42 PM

@jpienaar @jroelofs Sorry that I missed this at the time.

@jpienaar -- does Jon's patch dc078e6eaacf work for you?

@jpienaar @jroelofs Sorry that I missed this at the time.

@jpienaar -- does Jon's patch dc078e6eaacf work for you?

Ah missed your response. I'll check tomorrow.