diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-06-21 02:42:58 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-06-21 02:42:58 +0200 |
commit | b3930f14c0c9bb7e4c69664090c568900849c50a (patch) | |
tree | 1cb32d923c2257910ce2f4e1dea9c2e4ec2edf60 | |
parent | 0084f362a29363ae25fdf36f414d5233ccae1dcd (diff) |
Set target triple in LLVM
-rw-r--r-- | src/codegen.c | 5 |
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); |