diff --git a/pkgs/development/compilers/llvm/13/clang/add-nostdlibinc-flag.patch b/pkgs/development/compilers/llvm/13/clang/add-nostdlibinc-flag.patch deleted file mode 100644 index 8007ba05f6e12..0000000000000 --- a/pkgs/development/compilers/llvm/13/clang/add-nostdlibinc-flag.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp -index 94a7553e273b..8a1d455950b2 100644 ---- a/lib/Driver/Driver.cpp -+++ b/lib/Driver/Driver.cpp -@@ -412,6 +412,13 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { - } - #endif - -+ { -+ Arg *A = DAL->MakeFlagArg(/*BaseArg=*/nullptr, -+ Opts.getOption(options::OPT_nostdlibinc)); -+ A->claim(); -+ DAL->append(A); -+ } -+ - return DAL; - } - diff --git a/pkgs/development/compilers/llvm/13/clang/default.nix b/pkgs/development/compilers/llvm/13/clang/default.nix index 056a1b7e0f0db..a38e183fb7d1b 100644 --- a/pkgs/development/compilers/llvm/13/clang/default.nix +++ b/pkgs/development/compilers/llvm/13/clang/default.nix @@ -42,7 +42,7 @@ let # mis-compilation in firefox. # See: https://bugzilla.mozilla.org/show_bug.cgi?id=1741454 ./revert-malloc-alignment-assumption.patch - ./add-nostdlibinc-flag.patch + ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { src = ../../clang-11-12-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; diff --git a/pkgs/development/compilers/llvm/14/clang/add-nostdlibinc-flag.patch b/pkgs/development/compilers/llvm/14/clang/add-nostdlibinc-flag.patch deleted file mode 100644 index b73cd0185eb6c..0000000000000 --- a/pkgs/development/compilers/llvm/14/clang/add-nostdlibinc-flag.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp -index 3bfddeefc7b2..05b11d9e562d 100644 ---- a/lib/Driver/Driver.cpp -+++ b/lib/Driver/Driver.cpp -@@ -482,6 +482,13 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { - } - #endif - -+ { -+ Arg *A = DAL->MakeFlagArg(/*BaseArg=*/nullptr, -+ Opts.getOption(options::OPT_nostdlibinc)); -+ A->claim(); -+ DAL->append(A); -+ } -+ - return DAL; - } - diff --git a/pkgs/development/compilers/llvm/14/clang/default.nix b/pkgs/development/compilers/llvm/14/clang/default.nix index 55d879fb76e4c..3a5d0821e1a0b 100644 --- a/pkgs/development/compilers/llvm/14/clang/default.nix +++ b/pkgs/development/compilers/llvm/14/clang/default.nix @@ -45,7 +45,7 @@ let ./purity.patch # https://reviews.llvm.org/D51899 ./gnu-install-dirs.patch - ./add-nostdlibinc-flag.patch + ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { src = ../../clang-11-12-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; diff --git a/pkgs/development/compilers/llvm/15/clang/default.nix b/pkgs/development/compilers/llvm/15/clang/default.nix index b0671150a7bd9..5c1aef6eb3af3 100644 --- a/pkgs/development/compilers/llvm/15/clang/default.nix +++ b/pkgs/development/compilers/llvm/15/clang/default.nix @@ -45,6 +45,7 @@ let ./purity.patch # https://reviews.llvm.org/D51899 ./gnu-install-dirs.patch + ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { src = ../../clang-11-12-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; @@ -53,10 +54,6 @@ let postPatch = '' (cd tools && ln -s ../../clang-tools-extra extra) - - sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \ - -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \ - lib/Driver/ToolChains/*.cpp '' + lib.optionalString stdenv.hostPlatform.isMusl '' sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp ''; diff --git a/pkgs/development/compilers/llvm/git/clang/add-nostdlibinc-flag.patch b/pkgs/development/compilers/llvm/common/clang/add-nostdlibinc-flag.patch similarity index 100% rename from pkgs/development/compilers/llvm/git/clang/add-nostdlibinc-flag.patch rename to pkgs/development/compilers/llvm/common/clang/add-nostdlibinc-flag.patch diff --git a/pkgs/development/compilers/llvm/git/clang/default.nix b/pkgs/development/compilers/llvm/git/clang/default.nix index 8f2663b7e896c..b121835044d7a 100644 --- a/pkgs/development/compilers/llvm/git/clang/default.nix +++ b/pkgs/development/compilers/llvm/git/clang/default.nix @@ -46,7 +46,7 @@ let ./purity.patch # https://reviews.llvm.org/D51899 ./gnu-install-dirs.patch - ./add-nostdlibinc-flag.patch + ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { src = ../../clang-11-12-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib";