aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTetralux <tetralux@teknik.io>2021-02-24 02:17:08 +0000
committerTetralux <tetralux@teknik.io>2021-02-24 02:18:47 +0000
commita9af8b093d20d1828bf560acdb7d809169c60464 (patch)
tree13ca5f14d13d8d00d05d3638d3a1700d337d22be /src
parent595885d3db29bd3d611427877a52e574fe878a9e (diff)
Fix -build-mode:shared on Darwin
Apparently, the '__$startup_runtime' symbol to initialize RTTI stuff has three underscores (not two) on Darwin!
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 92e0b4104..8b83c1d35 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2394,7 +2394,8 @@ int main(int arg_count, char const **arg_ptr) {
// so use ld instead.
// :UseLDForShared
linker = "ld";
- link_settings = gb_string_appendc(link_settings, "-init '__$startup_runtime' ");
+ // NOTE(tetra, 2021-02-24): On Darwin, the symbol has _3_ underscores; on Linux, it only has 2.
+ link_settings = gb_string_append_fmt(link_settings, "-init '%s$startup_runtime' ", build_context.metrics.os == TargetOs_darwin ? "___" : "__");
// Shared libraries are .dylib on MacOS and .so on Linux.
#if defined(GB_SYSTEM_OSX)
output_ext = STR_LIT(".dylib");