-undefined dynamic_lookup broken on macOS26 Tahoe
Summary
We rely on -undefined dynamic_lookup to compile the rts with references that will be solved at dynamic linking time to some symbols e.g. from ghc-internal, given such as
...
"-Wl,-u,_hs_atomicwrite32"
"-Wl,-u,_hs_atomicwrite64"
"-Wl,-u,_ghczminternal_GHCziInternalziStackziCloneStack_StackSnapshot_closure"
On macOS 15.5 Sequoia, -undefined dynamic_lookup behaves as described (in the manpage), however, in macOS 26 Tahoe, -undefined dynamic_lookup is seemingly ignored and behaves like -undefined error.
This was originally reported under #26152 (closed) by a user that failed to build GHC on the new macOS version.
Steps to reproduce
Write a main.c file
int main(void) { return 0; }
Compile with
gcc main.c -Wl,-undefined,dynamic_lookup -Wl,-u,mytest
Observe this works on macOS 15 but fails on macOS 26 beta. This also fails with -Wl,-no_fixup_chains. The error message looks something like:
Undefined symbols for architecture arm64:
"mytest", referenced from:
<initial-undefines>
ld: symbol(s) not found for architecture arm64