From b3930f14c0c9bb7e4c69664090c568900849c50a Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 21 Jun 2024 02:42:58 +0200 Subject: Set target triple in LLVM --- src/codegen.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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 #include +#include #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); -- cgit v1.2.3