Summary #
The linker flag -Wl,-force_load is macOS-specific; Linux should use --whole-archive wrapping.
The Problem #
In nix/package.nix line 49, parserStaticLibs uses -Wl,-force_load,${pkg}/lib/libparser.a for each grammar archive. This flag is only valid on macOS (ld64). On Linux, the equivalent is -Wl,--whole-archive ... -Wl,--no-whole-archive. Since the derivation sets platforms = platforms.darwin, this is not a runtime issue, but it limits portability. If a contributor tries to build on Linux, the link will fail.
Impact #
- category: maintainability
- description: -Wl,-force_load is macOS-specific; Linux builds need --whole-archive wrappers
Recommended Fix #
Add a conditional: if stdenv.isDarwin, use -Wl,-force_load; if stdenv.isLinux, use -Wl,--whole-archive ... -Wl,--no-whole-archive. Or use Nixpkgs' linkFarm or lib.optionalString.
Commit range: 771c13a..771c13a
Code Review: CR-2026-07-27-11