Tracking down what broke boehm-gc-static-aarch64-apple-darwin

unclear what the correct fix is. the upstream LLVM build is setup so only -lc++ is required when linking against shared objects, which is why libc++.so is a linker script and on darwin libc++.dylib re-exports libc++abi.dylib but on static builds there isn’t any such provision.

⚙ D96070 [clang] [driver] Enable static linking to libc++ suggests to just merge libc++abi.a into libc++.a which seems reasonable. I no longer have access to a darwin system but this patch to libcxx makes nix-build -A pkgsStatic.pkgsLLVM.boehmgc build on linux without having to add -lc++abi.

diff --git a/pkgs/development/compilers/llvm/common/libcxx/default.nix b/pkgs/development/compilers/llvm/common/libcxx/default.nix
index de895125f883..a5945804dfd2 100644
--- a/pkgs/development/compilers/llvm/common/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/common/libcxx/default.nix
@@ -126,6 +126,21 @@ stdenv.mkDerivation (rec {
   postInstall = lib.optionalString (cxxabi != null) ''
     lndir ${lib.getDev cxxabi}/include $dev/include/c++/v1
     lndir ${lib.getLib cxxabi}/lib $out/lib
+  '' + ''
+    if [[ -f $out/lib/libc++.a && -f $out/lib/libc++abi.a ]]; then
+      scratch="$(mktemp -d)"
+      mv $out/lib/libc++.a $scratch/libcxx.a
+      cp $out/lib/libc++abi.a $scratch/libcxxabi.a
+      $AR -M <<MRI
+      create libcxx.a
+      addlib $scratch/libcxx.a
+      addlib $scratch/libcxxabi.a
+      save
+      end
+    MRI
+      mv libcxx.a $out/lib/libc++.a
+      rm -rf $scratch
+    fi
   '';
 
   passthru = {