mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
change macOS to not use "-dead_strip_dylibs" when CUSTOM is defined
Under macOS, to reduce dependency chains, we remove functions and data that are unreachable by the entry point or exported symbols. In particular, the macOS linker is used with "-dead_strip". While calc on macOS will execute if linker used with "-dead_strip_dylibs" and CUSTOM is defined, other applications that use libcalc but not libcustcalc (such as sample_many and sample_rand) will fail to execute due to missile symbols. Therefore "-dead_strip_dylibs" is not used by default when ALLOW_CUSTOM is "-DCUSTOM" under macOS.
This commit is contained in:
@@ -177,7 +177,22 @@ LIBCUSTCALC_SHLIB= -dynamiclib -undefined dynamic_lookup \
|
||||
# data that are unreachable by the entry point or exported symbols.
|
||||
#
|
||||
COMMON_LDFLAGS+= -Wl,-dead_strip
|
||||
|
||||
# Do not link with "-dead_strip_dylibs" if CUSTOM is defined
|
||||
# (i.e., ${ALLOW_CUSTOM} is "-DCUSTOM). This is because unless
|
||||
# the application makes an explicit symbol reference to some symbol
|
||||
# in libcustcalc, the application will fail to execute due to
|
||||
# a missing symbol.
|
||||
#
|
||||
# The calc application will run with CUSTOM defined under
|
||||
# "-dead_strip_dylibs" because calc.o (in main()) makes an explicit
|
||||
# reference to custtbl_allowed (see custom/custtbl.c) in libcustcalc.
|
||||
# However applications such as sample_many and sample_rand will
|
||||
# fail to load when CUSTOM is defined and "-dead_strip_dylibs" is used..
|
||||
#
|
||||
ifneq ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
COMMON_LDFLAGS+= -Wl,-dead_strip_dylibs
|
||||
endif # ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
|
||||
# static library option
|
||||
#
|
||||
|
Reference in New Issue
Block a user