From 622fa818bcc7521fefa7786b3112c78adb18c31b Mon Sep 17 00:00:00 2001 From: Fabrice <67000409+Fabbboy@users.noreply.github.com> Date: Tue, 13 Jan 2026 20:56:40 +0100 Subject: Adds static linking to non-windows platforms (#6057) --- src/linker.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/linker.cpp') 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 -- cgit v1.2.3