Skip to content

Commit

Permalink
llvm: fix target triple (#30554)
Browse files Browse the repository at this point in the history
broken by their move to cmake causing a switch away from the standard --host/--build autoconf

fix #28046
  • Loading branch information
vtjnash authored and KristofferC committed Feb 4, 2019
1 parent 7cbe7c1 commit 843adcf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions deps/curr_check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1896c83c6bad4f1ab2a5c1fa04f694597e8319e1892eb48c74ce85dad82c924c143c1e09b8d86354ba7b1ef001237a52b503c9ebe06eef61dd16c3689a5e9b30
2 changes: 1 addition & 1 deletion deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions deps/true_check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1896c83c6bad4f1ab2a5c1fa04f694597e8319e1892eb48c74ce85dad82c924c143c1e09b8d86354ba7b1ef001237a52b503c9ebe06eef61dd16c3689a5e9b30
16 changes: 7 additions & 9 deletions src/disasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MCStreamer> Streamer;
SourceMgr SrcMgr;

std::unique_ptr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*TheTarget->createMCRegInfo(TripleName),TripleName));
std::unique_ptr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*TheTarget->createMCRegInfo(TheTriple.str()), TheTriple.str()));
assert(MAI && "Unable to create target asm info!");

std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));
std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TheTriple.str()));
assert(MRI && "Unable to create target register info!");

std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
Expand All @@ -659,16 +658,15 @@ static void jl_dump_asm_internal(

// Set up Subtarget and Disassembler
std::unique_ptr<MCSubtargetInfo>
STI(TheTarget->createMCSubtargetInfo(TripleName, cpu, features));
STI(TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features));
std::unique_ptr<MCDisassembler> 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;
Expand Down

0 comments on commit 843adcf

Please sign in to comment.