Skip to content

Commit

Permalink
llvmPackages_{14, git}.clang: add nostdlibinc flag
Browse files Browse the repository at this point in the history
Fix header search paths as NixOS#153963
  • Loading branch information
crabtw committed Sep 30, 2022
1 parent 1d5f427 commit 44165d3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}

5 changes: 1 addition & 4 deletions pkgs/development/compilers/llvm/14/clang/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 ''
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

5 changes: 1 addition & 4 deletions pkgs/development/compilers/llvm/git/clang/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 ''
Expand Down

0 comments on commit 44165d3

Please sign in to comment.