add -dead_strip_dylibs by default to the macOS linker

Under macOS, to reduce dependency chains, we remove functions and
data that are unreachable by the entry point or exported symbols.
In particular, the linker is run with "-dead_strip" and with
"-dead_strip_dylibs".
This commit is contained in:
Landon Curt Noll
2023-08-14 04:11:33 -07:00
parent ee900ec6ec
commit e0df1646fc
12 changed files with 51 additions and 26 deletions

View File

@@ -165,14 +165,7 @@ LIBCUSTCALC_SHLIB= -dynamiclib -undefined dynamic_lookup \
# To reduce dependency chains under macOS, we remove functions and
# data that are unreachable by the entry point or exported symbols.
#
LDFLAGS+= -Wl,-dead_strip
# NOTE: Do not use: LDFLAGS+= -Wl,-dead_strip_dylibs
#
# This option should not be used when linking against a dylib which is
# required at runtime for some indirect reason such as the dylib has an
# important initializer. The libcalc and libcustcalc have
# important initializers, and so this option should not be used.
LDFLAGS+= -Wl,-dead_strip -Wl,-dead_strip_dylibs
# static library option
#