aboutsummaryrefslogtreecommitdiff
path: root/src/linker.cpp
diff options
context:
space:
mode:
authorFabrice <67000409+Fabbboy@users.noreply.github.com>2026-01-13 20:56:40 +0100
committerGitHub <noreply@github.com>2026-01-13 20:56:40 +0100
commit622fa818bcc7521fefa7786b3112c78adb18c31b (patch)
tree1690e876cda02e0706e227d73ec05c395ced3eb6 /src/linker.cpp
parent291f7c39e622f19e3bb701a5a44591ddf78ed7ad (diff)
Adds static linking to non-windows platforms (#6057)
Diffstat (limited to 'src/linker.cpp')
-rw-r--r--src/linker.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/linker.cpp b/src/linker.cpp
index c2a3ee928..c68417994 100644
--- a/src/linker.cpp
+++ b/src/linker.cpp
@@ -737,7 +737,21 @@ try_cross_linking:;
}
if (build_context.build_mode == BuildMode_StaticLibrary) {
- compiler_error("TODO(bill): -build-mode:static on non-windows targets");
+ TIME_SECTION("Static Library Creation");
+
+ gbString ar_command = gb_string_make(heap_allocator(), "");
+ defer (gb_string_free(ar_command));
+
+ ar_command = gb_string_appendc(ar_command, "ar rcs ");
+ ar_command = gb_string_append_fmt(ar_command, "\"%.*s\" ", LIT(output_filename));
+ ar_command = gb_string_appendc(ar_command, object_files);
+
+ result = system_exec_command_line_app("ar", ar_command);
+ if (result) {
+ return result;
+ }
+
+ return result;
}
// NOTE(dweiler): We use clang as a frontend for the linker as there are