fix LTO on MacOS

If no `-minimum-os-version` is given, ignore the `override-module`
warnings. The user not using, `-minimum-os-version` opts you into linker
warnings about target versions.

If a `-minimum-os-version` is provided, normalize it to a full version
`11` to `11.0.0` for example. The linker seems to want that when doing
LTO.
This commit is contained in:
Laytan Laats
2026-02-02 18:13:48 +01:00
parent 3666c1d3aa
commit afbbb829ea
2 changed files with 30 additions and 1 deletions

View File

@@ -978,6 +978,10 @@ try_cross_linking:;
if (build_context.lto_kind != LTO_None) {
link_command_line = gb_string_appendc(link_command_line, " -flto=thin");
link_command_line = gb_string_append_fmt(link_command_line, " -flto-jobs=%d ", build_context.thread_count);
if (is_osx && !build_context.minimum_os_version_string_given) {
link_command_line = gb_string_appendc(link_command_line, " -Wno-override-module ");
}
}
link_command_line = gb_string_appendc(link_command_line, object_files);