Skip to content

Commit

Permalink
Merge pull request #12332 from ArchRobison/adr/svn
Browse files Browse the repository at this point in the history
Fix building with LLVM 3.8
  • Loading branch information
tkelman committed Jul 28, 2015
2 parents f8e3f8d + 6d476a7 commit 9390c71
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,11 @@ static void jl_dump_shadow(char *fname, int jit_model, const char *sysimg_data,
#ifdef LLVM37
// Reset the target triple to make sure it matches the new target machine
clone->setTargetTriple(TM->getTargetTriple().str());
#ifdef LLVM38
clone->setDataLayout(TM->createDataLayout());
#else
clone->setDataLayout(TM->getDataLayout()->getStringRepresentation());
#endif
#endif

// add metadata information
Expand Down
4 changes: 3 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5545,7 +5545,9 @@ extern "C" void jl_init_codegen(void)
);
delete targetMachine;
assert(jl_TargetMachine);
#if defined(LLVM36) && !defined(LLVM37)
#if defined(LLVM38)
engine_module->setDataLayout(jl_TargetMachine->createDataLayout());
#elif defined(LLVM36) && !defined(LLVM37)
engine_module->setDataLayout(jl_TargetMachine->getSubtargetImpl()->getDataLayout());
#elif defined(LLVM35) && !defined(LLVM37)
engine_module->setDataLayout(jl_TargetMachine->getDataLayout());
Expand Down
4 changes: 4 additions & 0 deletions src/llvm-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#include <llvm/Config/llvm-config.h>

#if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8
#define LLVM38 1
#endif

#if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7
#define LLVM37 1
#endif
Expand Down

0 comments on commit 9390c71

Please sign in to comment.