diff options
| author | Eric Huss <eric@huss.org> | 2023-04-21 19:29:32 -0700 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2023-04-23 09:35:56 -0700 |
| commit | e4e4110dc6a0dcd2bade2fd789e81a518618e9c0 (patch) | |
| tree | 79198d4591ee2c9818fa6135894dfe931ec71e32 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | fec9adcdbc21469ef105162cc8cabf81c72d06be (diff) | |
| download | rust-e4e4110dc6a0dcd2bade2fd789e81a518618e9c0.tar.gz rust-e4e4110dc6a0dcd2bade2fd789e81a518618e9c0.zip | |
Fix printing native CPU on cross-compiled compiler.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index c9acbab253e..78f29532ffb 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -310,12 +310,14 @@ static size_t getLongestEntryLength(ArrayRef<KV> Table) { extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) { const TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const Triple::ArchType HostArch = Triple(sys::getProcessTriple()).getArch(); + const Triple::ArchType HostArch = Triple(sys::getDefaultTargetTriple()).getArch(); const Triple::ArchType TargetArch = Target->getTargetTriple().getArch(); const ArrayRef<SubtargetSubTypeKV> CPUTable = MCInfo->getCPUTable(); unsigned MaxCPULen = getLongestEntryLength(CPUTable); printf("Available CPUs for this target:\n"); + // Don't print the "native" entry when the user specifies --target with a + // different arch since that could be wrong or misleading. if (HostArch == TargetArch) { const StringRef HostCPU = sys::getHostCPUName(); printf(" %-*s - Select the CPU of the current host (currently %.*s).\n", |
