[build] Enable ICF for Mac.

xcodebuild/ReleaseARM64/exe.stripped/dart -131k (-3.25%)

Change-Id: I9d3f4f39c77bb242e891e1996e217923bbc55d0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482984
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2026-02-24 11:08:51 -08:00
committed by Commit Queue
parent 0615d3a467
commit 240b9bef03
+7 -6
View File
@@ -887,12 +887,6 @@ if (is_win) {
"-Wl,--gc-sections",
]
if (is_clang && !using_sanitizer) {
# Identical code folding to reduce size.
# Warning: This changes C/C++ semantics of function pointer comparison.
common_optimize_on_ldflags += [ "-Wl,--icf=all" ]
}
if (!using_sanitizer) {
# Functions interposed by the sanitizers can make ld think
# that some libraries aren't needed when they actually are,
@@ -900,6 +894,13 @@ if (is_win) {
common_optimize_on_ldflags += [ "-Wl,--as-needed" ]
}
}
if (is_clang && !using_sanitizer) {
# Identical code folding to reduce size.
# Warning: This changes C/C++ semantics of function pointer comparison.
# Needs lld/gold/mold instead of GNU ld/Mac ld.
common_optimize_on_ldflags += [ "-Wl,--icf=all" ]
}
}
# Default "optimization on" config. On Windows, this favors size over speed.