diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2024-01-02 18:50:00 +0100 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2024-01-02 21:44:51 +0100 |
| commit | 8a7c2ea9d0e6b55bcfc5068ff2bf7c2a14ccfebf (patch) | |
| tree | a15864f5c253ef6adc9e3b995ab63e49fbb7e02c /src | |
| parent | cb1c10ce83b9a51244ad50dc7a8beb4f3271ae09 (diff) | |
darwin: actually honor no-crt by not linking with `-lSystem -lm`
Diffstat (limited to 'src')
| -rw-r--r-- | src/linker.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/linker.cpp b/src/linker.cpp index ef9fa8e59..4ab4b2cd1 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -483,10 +483,13 @@ gb_internal i32 linker_stage(LinkerData *gen) { gbString platform_lib_str = gb_string_make(heap_allocator(), ""); defer (gb_string_free(platform_lib_str)); if (build_context.metrics.os == TargetOs_darwin) { - platform_lib_str = gb_string_appendc(platform_lib_str, "-lm -Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib"); + platform_lib_str = gb_string_appendc(platform_lib_str, "-Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib"); #if defined(GB_SYSTEM_OSX) - if(gen->needs_system_library_linked == 1) { - platform_lib_str = gb_string_appendc(platform_lib_str, " -lSystem "); + if(!build_context.no_crt) { + platform_lib_str = gb_string_appendc(platform_lib_str, " -lm "); + if(gen->needs_system_library_linked == 1) { + platform_lib_str = gb_string_appendc(platform_lib_str, " -lSystem "); + } } #endif } else { |