Skip to content

Commit ff1a11c

Browse files
[Exegesis] Output error if mcpu flag is missing or incorrect when cross compiling
1 parent b936ef1 commit ff1a11c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/tools/llvm-exegesis/llvm-exegesis.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "llvm/Support/SourceMgr.h"
4545
#include "llvm/Support/TargetSelect.h"
4646
#include "llvm/TargetParser/Host.h"
47+
#include "llvm/TargetParser/Triple.h"
4748
#include <algorithm>
4849
#include <string>
4950

@@ -479,6 +480,12 @@ void benchmarkMain() {
479480
#endif
480481
}
481482

483+
// case for cross generating, when native arch and target mismatch
484+
if ((Triple(sys::getProcessTriple()).getArch() !=
485+
Triple(TripleName).getArch()) &&
486+
(MCPU == "native"))
487+
ExitWithError("Incorrect cpu. To see all possible options use -mcpu=help");
488+
482489
InitializeAllExegesisTargets();
483490
#define LLVM_EXEGESIS(TargetName) \
484491
LLVMInitialize##TargetName##AsmPrinter(); \

0 commit comments

Comments
 (0)