about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-02-23 10:30:37 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-26 13:40:24 +0000
commit1e26d33371a4a7238a644c49ddae49a4009c927f (patch)
tree4ef59cd06926e7bea35243c3710211c1961e9ffb /pkgs/development/compilers/llvm
parenteb2eafd2af7d466fb296e5716bdd0ec577de426d (diff)
downloadnixlib-1e26d33371a4a7238a644c49ddae49a4009c927f.tar
nixlib-1e26d33371a4a7238a644c49ddae49a4009c927f.tar.gz
nixlib-1e26d33371a4a7238a644c49ddae49a4009c927f.tar.bz2
nixlib-1e26d33371a4a7238a644c49ddae49a4009c927f.tar.lz
nixlib-1e26d33371a4a7238a644c49ddae49a4009c927f.tar.xz
nixlib-1e26d33371a4a7238a644c49ddae49a4009c927f.tar.zst
nixlib-1e26d33371a4a7238a644c49ddae49a4009c927f.zip
clang_15: add nostdlibinc flag
Port of 44165d36576 ("llvmPackages_{14, git}.clang: add nostdlibinc flag")
to Clang 15.  It was originally thought this wasn't needed[1], but it is,
to fix expressions like the following:

	with import ./. {};

	llvmPackages_15.libcxxStdenv.mkDerivation {
	  name = "libcxx-stdenv-c++-test";

	  dontUnpack = true;

	  input = ''
	    #include <cstdlib>

	    int main() {
	        std::abort();
	        return 0;
	    }
	  '';
	  passAsFile = [ "input" ];

	  installPhase = ''
	    $CXX -c -o $out -x c++ $inputPath
	   '';
	}

[1]: https://github.com/NixOS/nixpkgs/pull/194634#issue-1398202534
Diffstat (limited to 'pkgs/development/compilers/llvm')
-rw-r--r--pkgs/development/compilers/llvm/15/clang/default.nix5
1 files changed, 1 insertions, 4 deletions
diff --git a/pkgs/development/compilers/llvm/15/clang/default.nix b/pkgs/development/compilers/llvm/15/clang/default.nix
index b0671150a7bd..5c1aef6eb3af 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
     '';