llvmPackages_13.clang: add nostdlibinc flag

This patch adds nostdlibinc flag after parsing arguments
instead of sed substitution.

Fix #151879
main
Jyun-Yan You 2 years ago
parent 343b4c7523
commit 2fe19fe24a
  1. 18
      pkgs/development/compilers/llvm/13/clang/add-nostdlibinc-flag.patch
  2. 5
      pkgs/development/compilers/llvm/13/clang/default.nix

@ -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;
}

@ -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 ''

Loading…
Cancel
Save