aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2022-03-30 12:58:12 +0100
committerGitHub <noreply@github.com>2022-03-30 12:58:12 +0100
commitabf0fd7efccdb3e85381261c4c69b058d8289f2d (patch)
treeba7463d5210c21d1736000f94246b3c40a1fe7f2
parenta3c81374bebedf87374e0e15ffda3cae0e2d8cfe (diff)
parenta632db361849f80b888faf282b1b95c43ec37432 (diff)
Merge pull request #1671 from colrdavidson/add_nocrt
Make no crt work on Linux
-rw-r--r--core/runtime/entry_unix.odin2
-rw-r--r--src/main.cpp4
2 files changed, 5 insertions, 1 deletions
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 905571f44..9e470923d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -436,6 +436,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.