aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/codegen.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 145ce6e..3088cc1 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -3,6 +3,7 @@
#include <llvm-c/Analysis.h>
#include <llvm-c/Core.h>
+#include <llvm-c/ExecutionEngine.h>
#include "alloc.h"
#include "analyzer.h"
@@ -28,6 +29,8 @@ void
codegen(const char *file, struct type *types, struct ast ast,
struct lexemes toks)
{
+ char *triple = LLVMGetDefaultTargetTriple();
+
struct cgctx ctx;
ctx.a = NULL;
ctx.namespace.p = NULL;
@@ -35,6 +38,8 @@ codegen(const char *file, struct type *types, struct ast ast,
ctx.mod = LLVMModuleCreateWithNameInContext("oryx", ctx.ctx);
ctx.bob = LLVMCreateBuilderInContext(ctx.ctx);
LLVMSetSourceFileName(ctx.mod, file, strlen(file));
+ LLVMSetTarget(ctx.mod, triple);
+ LLVMDisposeMessage(triple);
arena_free(&ctx.a);