diff --git a/pkgs/development/compilers/llvm/13/clang/add-nostdlibinc-flag.patch b/pkgs/development/compilers/llvm/13/clang/add-nostdlibinc-flag.patch new file mode 100644 index 0000000000000..8007ba05f6e12 --- /dev/null +++ b/pkgs/development/compilers/llvm/13/clang/add-nostdlibinc-flag.patch @@ -0,0 +1,18 @@ +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 6c227f1ae72bb..62b9e0470a613 100644 --- a/pkgs/development/compilers/llvm/13/clang/default.nix +++ b/pkgs/development/compilers/llvm/13/clang/default.nix @@ -42,6 +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 (substituteAll { src = ../../clang-11-12-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; @@ -51,10 +52,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 - # Patch for standalone doc building sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt '' + lib.optionalString stdenv.hostPlatform.isMusl ''