Skip to content

Commit 9390c71

Browse files
committed
Merge pull request #12332 from ArchRobison/adr/svn
Fix building with LLVM 3.8
2 parents f8e3f8d + 6d476a7 commit 9390c71

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/cgutils.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,11 @@ static void jl_dump_shadow(char *fname, int jit_model, const char *sysimg_data,
492492
#ifdef LLVM37
493493
// Reset the target triple to make sure it matches the new target machine
494494
clone->setTargetTriple(TM->getTargetTriple().str());
495+
#ifdef LLVM38
496+
clone->setDataLayout(TM->createDataLayout());
497+
#else
495498
clone->setDataLayout(TM->getDataLayout()->getStringRepresentation());
499+
#endif
496500
#endif
497501

498502
// add metadata information

src/codegen.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -5545,7 +5545,9 @@ extern "C" void jl_init_codegen(void)
55455545
);
55465546
delete targetMachine;
55475547
assert(jl_TargetMachine);
5548-
#if defined(LLVM36) && !defined(LLVM37)
5548+
#if defined(LLVM38)
5549+
engine_module->setDataLayout(jl_TargetMachine->createDataLayout());
5550+
#elif defined(LLVM36) && !defined(LLVM37)
55495551
engine_module->setDataLayout(jl_TargetMachine->getSubtargetImpl()->getDataLayout());
55505552
#elif defined(LLVM35) && !defined(LLVM37)
55515553
engine_module->setDataLayout(jl_TargetMachine->getDataLayout());

src/llvm-version.h

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
#if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8
6+
#define LLVM38 1
7+
#endif
8+
59
#if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7
610
#define LLVM37 1
711
#endif

0 commit comments

Comments
 (0)