aboutsummaryrefslogtreecommitdiff
path: root/src/linker.cpp
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2024-03-25 21:55:58 +0100
committerLaytan Laats <laytanlaats@hotmail.com>2024-03-25 22:11:20 +0100
commitb26a685b769c99128f96a4b00c578775daec5192 (patch)
tree0ffdc37d958d4b7461c32213cbffd31216d20414 /src/linker.cpp
parent3a8971c260e097db5eb1186048425f638db88846 (diff)
darwin: be less annoying about "incompatible" library versions
After #3316 we set a default minimum version, now this will warn if you link with a library that is targeting later versions. This might be a bit annoying, especially when the user hasn't actually given Odin a minimum target. So this PR makes these warnings only show when you explicitly give a target version (afaik that is the only thing that -mmacosx-min-version actually does for us because we don't use it to compile anything, just to link).
Diffstat (limited to 'src/linker.cpp')
-rw-r--r--src/linker.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/linker.cpp b/src/linker.cpp
index 6699c9cb8..63987f9e8 100644
--- a/src/linker.cpp
+++ b/src/linker.cpp
@@ -502,9 +502,12 @@ gb_internal i32 linker_stage(LinkerData *gen) {
platform_lib_str = gb_string_appendc(platform_lib_str, "-L/opt/local/lib ");
}
- if (build_context.minimum_os_version_string.len) {
+ // Only specify this flag if the user has given a minimum version to target.
+ // This will cause warnings to show up for mismatched libraries.
+ if (build_context.minimum_os_version_string_given) {
link_settings = gb_string_append_fmt(link_settings, "-mmacosx-version-min=%.*s ", LIT(build_context.minimum_os_version_string));
}
+
// This points the linker to where the entry point is
link_settings = gb_string_appendc(link_settings, "-e _main ");
}