From a632db361849f80b888faf282b1b95c43ec37432 Mon Sep 17 00:00:00 2001 From: Colin Davidson Date: Wed, 30 Mar 2022 04:45:22 -0700 Subject: [PATCH] Make no crt work on Linux --- core/runtime/entry_unix.odin | 2 +- src/main.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/runtime/entry_unix.odin b/core/runtime/entry_unix.odin index 1a3def200..9f7d219c3 100644 --- a/core/runtime/entry_unix.odin +++ b/core/runtime/entry_unix.odin @@ -30,4 +30,4 @@ when ODIN_BUILD_MODE == .Dynamic { #force_no_inline _cleanup_runtime() return 0 } -} \ No newline at end of file +} diff --git a/src/main.cpp b/src/main.cpp index 63b2c8386..383997719 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -433,6 +433,10 @@ i32 linker_stage(lbGenerator *gen) { String output_ext = {}; gbString link_settings = gb_string_make_reserve(heap_allocator(), 32); + if (build_context.no_crt) { + link_settings = gb_string_append_fmt(link_settings, "-nostdlib "); + } + // NOTE(dweiler): We use clang as a frontend for the linker as there are // other runtime and compiler support libraries that need to be linked in // very specific orders such as libgcc_s, ld-linux-so, unwind, etc.