From 843adcfb5bdaa02e6bd041ba20dda9dc22b014c1 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Thu, 3 Jan 2019 13:12:50 -0500 Subject: [PATCH] llvm: fix target triple (#30554) broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046 --- deps/curr_check | 1 + deps/llvm.mk | 2 +- deps/true_check | 1 + src/disasm.cpp | 16 +++++++--------- 4 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 deps/curr_check create mode 100644 deps/true_check diff --git a/deps/curr_check b/deps/curr_check new file mode 100644 index 00000000000000..a2797dada0d53f --- /dev/null +++ b/deps/curr_check @@ -0,0 +1 @@ +1896c83c6bad4f1ab2a5c1fa04f694597e8319e1892eb48c74ce85dad82c924c143c1e09b8d86354ba7b1ef001237a52b503c9ebe06eef61dd16c3689a5e9b30 diff --git a/deps/llvm.mk b/deps/llvm.mk index 5af5f6363d5c6a..d09579b21e27e9 100644 --- a/deps/llvm.mk +++ b/deps/llvm.mk @@ -65,7 +65,7 @@ LLVM_CXXFLAGS += $(CXXFLAGS) LLVM_CPPFLAGS += $(CPPFLAGS) LLVM_LDFLAGS += $(LDFLAGS) LLVM_CMAKE += -DLLVM_TARGETS_TO_BUILD:STRING="$(LLVM_TARGETS)" -DCMAKE_BUILD_TYPE="$(LLVM_CMAKE_BUILDTYPE)" -LLVM_CMAKE += -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_LIBXML2=OFF +LLVM_CMAKE += -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_HOST_TRIPLE="$(or $(XC_HOST),$(BUILD_MACHINE))" ifeq ($(USE_POLLY_ACC),1) LLVM_CMAKE += -DPOLLY_ENABLE_GPGPU_CODEGEN=ON endif diff --git a/deps/true_check b/deps/true_check new file mode 100644 index 00000000000000..a2797dada0d53f --- /dev/null +++ b/deps/true_check @@ -0,0 +1 @@ +1896c83c6bad4f1ab2a5c1fa04f694597e8319e1892eb48c74ce85dad82c924c143c1e09b8d86354ba7b1ef001237a52b503c9ebe06eef61dd16c3689a5e9b30 diff --git a/src/disasm.cpp b/src/disasm.cpp index c7f74765cba652..bff8dd91f697a5 100644 --- a/src/disasm.cpp +++ b/src/disasm.cpp @@ -628,24 +628,23 @@ static void jl_dump_asm_internal( { // GC safe // Get the host information - std::string TripleName = sys::getDefaultTargetTriple(); - Triple TheTriple(Triple::normalize(TripleName)); + Triple TheTriple(sys::getProcessTriple()); const auto &target = jl_get_llvm_disasm_target(); const auto &cpu = target.first; const auto &features = target.second; std::string err; - const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, err); + const Target *TheTarget = TargetRegistry::lookupTarget(TheTriple.str(), err); // Set up required helpers and streamer std::unique_ptr Streamer; SourceMgr SrcMgr; - std::unique_ptr MAI(TheTarget->createMCAsmInfo(*TheTarget->createMCRegInfo(TripleName),TripleName)); + std::unique_ptr MAI(TheTarget->createMCAsmInfo(*TheTarget->createMCRegInfo(TheTriple.str()), TheTriple.str())); assert(MAI && "Unable to create target asm info!"); - std::unique_ptr MRI(TheTarget->createMCRegInfo(TripleName)); + std::unique_ptr MRI(TheTarget->createMCRegInfo(TheTriple.str())); assert(MRI && "Unable to create target register info!"); std::unique_ptr MOFI(new MCObjectFileInfo()); @@ -659,16 +658,15 @@ static void jl_dump_asm_internal( // Set up Subtarget and Disassembler std::unique_ptr - STI(TheTarget->createMCSubtargetInfo(TripleName, cpu, features)); + STI(TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features)); std::unique_ptr DisAsm(TheTarget->createMCDisassembler(*STI, Ctx)); if (!DisAsm) { - jl_printf(JL_STDERR, "ERROR: no disassembler for target %s\n", - TripleName.c_str()); + rstream << "ERROR: no disassembler for target " << TheTriple.str(); return; } unsigned OutputAsmVariant = 0; // ATT or Intel-style assembly - if (strcmp(asm_variant, "intel")==0) { + if (strcmp(asm_variant, "intel") == 0) { OutputAsmVariant = 1; } bool ShowEncoding = false;