Currently, overriding llvmPackages.libllvm doesn’t work correctly. The
original version of libllvm will also be built because it is referenced
by libclang. Switching to the fixpoint allows the override to be
propagated to clang as expected. This will be needed for future Darwin
stdenv bootstrap improvements.
This dependency was introduced by unconditionally enabled
enableGoldPlugin option, which was enabled only if libbfd explicitly
supports plugin api prior to llvm-16. In llvm-17+ it was enabled
unconditionally (unless overriden explicitly), which introduces
dependency on binutils for target platform and breaks build for
platforms that are not supported by binutils (such as ghcjs).
since https://github.com/NixOS/nixpkgs/pull/292043 libcxxabi is built
using the same compiler wrapper as libcxx and thus uses the
`-rtlib=compiler-rt`. Adding the `LIBCXXABI_USE_COMPILER_RT=ON` at build
time ensures that the compiler-rt libraries provided at link time
resolving symbol errors for aarch64 pkgLLVM.libcxx build
https://hydra.nixos.org/build/253162977
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
- merge libcxxabi into libcxx for LLVM 12, 13, 14, 15, 16, 17, and git.
- remove the link time workaround `-lc++ -lc++abi` from 58 packages as it is no longer required.
- fixes https://github.com/NixOS/nixpkgs/issues/166205
- provides alternative fixes for. https://github.com/NixOS/nixpkgs/issues/269548https://github.com/NixOS/nix/issues/9640
- pkgsCross.x86_64-freebsd builds work again
This change can be represented in 3 stages
1. merge libcxxabi into libcxx -- files: pkgs/development/compilers/llvm/[12, git]/{libcxx, libcxxabi}
2. update stdenv to account for merge -- files: stdenv.{adapters, cc.wrapper, darwin}
3. remove all references to libcxxabi outside of llvm (about 58 packages modified)
### merging libcxxabi into libcxx
- take the union of the libcxxabi and libcxx cmake flags
- eliminate the libcxx-headers-only package - it was only needed to break libcxx <-> libcxxabi circular dependency
- libcxx.cxxabi is removed. external cxxabi (freebsd) will symlink headers / libs into libcxx.
- darwin will re-export the libcxxabi symbols into libcxx so linking `-lc++` is sufficient.
- linux/freebsd `libc++.so` is a linker script `LINK(libc++.so.1, -lc++abi)` making `-lc++` sufficient.
- libcxx/default.nix [12, 17] are identical except for patches and `LIBCXX_ADDITIONAL_LIBRARIES` (only used in 16+)
- git/libcxx/defaul.nix does not link with -nostdlib when useLLVM is true so flag is removed. this is not much different than before as libcxxabi used -nostdlib where libcxx did not, so libc was linked in anyway.
### stdenv changes
- darwin bootstrap, remove references to libcxxabi and cxxabi
- cc-wrapper: remove c++ link workaround when libcxx.cxxabi doesn't exist (still exists for LLVM pre 12)
- adapter: update overrideLibcxx to account for a pkgs.stdenv that only has libcxx
### 58 package updates
- remove `NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}` as no longer needed
- swift, nodejs_v8 remove libcxxabi references in the clang override
https://github.com/NixOS/nixpkgs/pull/292043
This test fails in the presence of anti-virus software or other
intrusion-detection software that modifies the atime when run.
See nixos/nixpkgs#284056 and llvm/llvm-project#82372.
this allows a compiler derivation to provide a
hardeningUnsupportedFlagsByTargetPlatform passthru attr
that will be called with the targetPlatform to determine
the unsupported hardening flags for that platform.
we can do this because even though a clang compiler is
multi-target by nature, cc-wrapper effectively fixes the
target platform at wrapping time. otherwise we'd have to
sniff the intended target at runtime, which wouldn't
be fun at all.
the advantage of using a new attribute instead of
allowing hardeningUnsupportedFlags to optionally be a
function is that hardeningUnsupportedFlags retains its
simple overriding pattern for simple cases (i.e.
`(prev.hardeningUnsupportedFlags or []) ++ [ "foo" ]`
) which will continue to work as long as the bottom-most
function of hardeningUnsupportedFlagsByTargetPlatform
falls back to hardeningUnsupportedFlags.
c33c7c3d5f ("clang_11: Fix RISC-V builds for compiler-rt. (#135718)")
already marked tihs as broken for LLVM 11, but didn't apply the same
change to other affected LLVM versions.
This change applies the upstream PR
https://github.com/llvm/llvm-project/pull/77218 so the same link flags
on darwin are used as when LIBCXX_CXX_ABI=libcxxabi. Specifically, this
adds
"-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/notweak.exp"
which prevents libcxx from segfaulting on darwin
compiler-rt includes <linux/unistd.h> on RISC-V. This only seems to
be necessary for useLLVM, but looking at the source code I can't
see any reason for that, so probably in the non-useLLVM case it just
gets propagated in.