From a413234974fcba9a58186060f27bbef15ad2babf Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Sat, 29 Mar 2025 23:21:13 -0700 Subject: [PATCH] llvmPackages_{12,13,14,15,16,17,18,19,20,git}.compiler-rt: optional string cflags link --- .../llvm/common/compiler-rt/default.nix | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index a619e0b69d0f..60f050bb2530 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -147,26 +147,24 @@ stdenv.mkDerivation (finalAttrs: { lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders ++ lib.optional (stdenv.hostPlatform.isFreeBSD) freebsd.include; - env = - { - NIX_CFLAGS_COMPILE = toString ( - [ - "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" - ] - ++ lib.optionals (!haveLibc) [ - # The compiler got stricter about this, and there is a usellvm patch below - # which patches out the assert include causing an implicit definition of - # assert. It would be nicer to understand why compiler-rt thinks it should - # be able to #include in the first place; perhaps it's in the - # wrong, or perhaps there is a way to provide an assert.h. - "-Wno-error=implicit-function-declaration" - ] - ); - } - // lib.optionalAttrs (stdenv.hostPlatform.isDarwin) { - # Work around clang’s trying to invoke unprefixed-ld on Darwin when `-target` is passed. - NIX_CFLAGS_LINK = "--ld-path=${stdenv.cc.bintools}/bin/${stdenv.cc.targetPrefix}ld"; - }; + env = { + NIX_CFLAGS_COMPILE = toString ( + [ + "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" + ] + ++ lib.optionals (!haveLibc) [ + # The compiler got stricter about this, and there is a usellvm patch below + # which patches out the assert include causing an implicit definition of + # assert. It would be nicer to understand why compiler-rt thinks it should + # be able to #include in the first place; perhaps it's in the + # wrong, or perhaps there is a way to provide an assert.h. + "-Wno-error=implicit-function-declaration" + ] + ); + + # Work around clang’s trying to invoke unprefixed-ld on Darwin when `-target` is passed. + NIX_CFLAGS_LINK = lib.optionalString (stdenv.hostPlatform.isDarwin) "--ld-path=${stdenv.cc.bintools}/bin/${stdenv.cc.targetPrefix}ld"; + }; cmakeFlags = [