summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-09-08 11:24:43 +0200
committerGitHub <noreply@github.com>2022-09-08 11:24:43 +0200
commit8b79a19426c7f5eab04caa573866276c76c70871 (patch)
tree3c93bbc143612aa2d5487b9c0918b74629bdd714 /platform/macos
parent69233093d7e6479b5130bf2c39cbf464a6809c1b (diff)
parentc2c659db326591519d451d368c4e33c78bb9c1fa (diff)
Merge pull request #63288 from akien-mga/scons-refactor-lto
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/detect.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/macos/detect.py b/platform/macos/detect.py
index bd89e8d59f..bcf4776609 100644
--- a/platform/macos/detect.py
+++ b/platform/macos/detect.py
@@ -40,6 +40,9 @@ def get_flags():
return [
("arch", detect_arch()),
("use_volk", False),
+ # Benefits of LTO for macOS (size, performance) haven't been clearly established yet.
+ # So for now we override the default value which may be set when using `production=yes`.
+ ("lto", "none"),
]
@@ -166,6 +169,15 @@ def configure(env):
env["RANLIB"] = basecmd + "ranlib"
env["AS"] = basecmd + "as"
+ # LTO
+ if env["lto"] != "none":
+ if env["lto"] == "thin":
+ env.Append(CCFLAGS=["-flto=thin"])
+ env.Append(LINKFLAGS=["-flto=thin"])
+ else:
+ env.Append(CCFLAGS=["-flto"])
+ env.Append(LINKFLAGS=["-flto"])
+
if env["use_ubsan"] or env["use_asan"] or env["use_tsan"]:
env.extra_suffix += ".san"
env.Append(CCFLAGS=["-DSANITIZERS_ENABLED"])