aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2021-02-25 12:17:29 +0000
committerGitHub <noreply@github.com>2021-02-25 12:17:29 +0000
commit53e4c536a1458cb1b44a981a6e93790863a91188 (patch)
treece90a2aeca71a480d59607f9d14e844ad01c4933 /src/main.cpp
parent84deee75cc4e7b0d0d37352ce81868564821acfb (diff)
parenta9af8b093d20d1828bf560acdb7d809169c60464 (diff)
Merge pull request #852 from Tetralux/fix-dll-mac
Fix -build-mode:shared on Darwin
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4ab4df7be..06412bcf3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2441,7 +2441,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");