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:
Landon Curt Noll
2023-08-14 17:08:28 -07:00
parent af9b052fe9
commit 7d8d4cb5ea
5 changed files with 34 additions and 24 deletions

10
calc.c
View File

@@ -166,6 +166,11 @@ main(int argc, char **argv)
#if defined(CUSTOM)
/*
* validate custtbl_allowed value
*
* We make an explicit reference to the custtbl_allowed symbol
* in libcustcalc (see custom/custtbl.c) so that the use
* of "-dead_strip_dylibs" with the macOS linker won't cause
* the calc to fail to load due to a missing symbol.
*/
if (custtbl_allowed == 0) {
fprintf(stderr, "%s: calc was built with "
@@ -183,6 +188,11 @@ main(int argc, char **argv)
#else /* CUSTOM */
/*
* validate custtbl_allowed value
*
* We make an explicit reference to the custtbl_allowed symbol
* in libcustcalc (see custom/custtbl.c) so that the use
* of "-dead_strip_dylibs" with the macOS linker won't cause
* the calc to fail to load due to a missing symbol.
*/
if (custtbl_allowed != 0) {
fprintf(stderr, "%s: calc was built with "