From ebb719cf60d0352a6b6e3601e4501cf2eb6f04d5 Mon Sep 17 00:00:00 2001 From: Antoniu Pop Date: Fri, 25 Feb 2022 21:47:47 +0000 Subject: [PATCH] fix(compiler): generate PIC code by default to allow generating shared libraries. --- compiler/lib/Support/LLVMEmitFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/lib/Support/LLVMEmitFile.cpp b/compiler/lib/Support/LLVMEmitFile.cpp index ca0dfcaae..56f42e61b 100644 --- a/compiler/lib/Support/LLVMEmitFile.cpp +++ b/compiler/lib/Support/LLVMEmitFile.cpp @@ -32,8 +32,8 @@ llvm::TargetMachine *getDefaultTargetMachine() { auto CPU = "generic"; auto Features = ""; llvm::TargetOptions opt; - auto RM = llvm::Optional(); - return Target->createTargetMachine(TargetTriple, CPU, Features, opt, RM); + return Target->createTargetMachine(TargetTriple, CPU, Features, opt, + llvm::Reloc::PIC_); } llvm::Error emitObject(llvm::Module &module, string objectPath) {