Skip to content

Commit

Permalink
Fix object file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
learnforpractice committed Feb 2, 2023
1 parent 8421e8f commit 91b4eb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions codon/cir/llvm/llvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,12 @@ llvm::Function *LLVMVisitor::getFunc(const Func *func) {

std::unique_ptr<llvm::Module> LLVMVisitor::makeModule(llvm::LLVMContext &context,
const SrcInfo *src) {
auto builder = llvm::EngineBuilder();
builder.setMArch(llvm::codegen::getMArch());

auto M = std::make_unique<llvm::Module>("codon", context);
M->setTargetTriple(llvm::EngineBuilder().selectTarget()->getTargetTriple().str());
M->setDataLayout(llvm::EngineBuilder().selectTarget()->createDataLayout());
M->setTargetTriple(builder.selectTarget()->getTargetTriple().str());
M->setDataLayout(builder.selectTarget()->createDataLayout());
B = std::make_unique<llvm::IRBuilder<>>(context);

auto *srcInfo = src ? src : getDefaultSrcInfo();
Expand Down
1 change: 1 addition & 0 deletions codon/cir/llvm/llvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/CodeGen/CommandFlags.h"
#include "llvm/DebugInfo/Symbolize/Symbolize.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/GenericValue.h"
Expand Down

0 comments on commit 91b4eb9

Please sign in to comment.