llvmPackages_{14, git}.clang: add nostdlibinc flag

Fix header search paths as #153963
This commit is contained in:
Jyun-Yan You
2022-09-29 23:08:22 +08:00
parent 1d5f427e36
commit 44165d3657
4 changed files with 38 additions and 8 deletions

View File

@@ -0,0 +1,18 @@
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;
}

View File

@@ -45,6 +45,7 @@ let
./purity.patch
# https://reviews.llvm.org/D51899
./gnu-install-dirs.patch
./add-nostdlibinc-flag.patch
(substituteAll {
src = ../../clang-11-12-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
@@ -54,10 +55,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 ''

View File

@@ -0,0 +1,18 @@
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 3f29afd35971..223d2769cdfc 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -491,6 +491,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;
}

View File

@@ -46,6 +46,7 @@ let
./purity.patch
# https://reviews.llvm.org/D51899
./gnu-install-dirs.patch
./add-nostdlibinc-flag.patch
(substituteAll {
src = ../../clang-11-12-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
@@ -55,10 +56,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 ''