about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/4
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/4')
-rw-r--r--pkgs/development/compilers/llvm/4/clang/0001-Fix-compilation-w-gcc9.patch59
-rw-r--r--pkgs/development/compilers/llvm/4/clang/default.nix116
-rw-r--r--pkgs/development/compilers/llvm/4/clang/purity.patch16
-rw-r--r--pkgs/development/compilers/llvm/4/cmdline-help.patch39
-rw-r--r--pkgs/development/compilers/llvm/4/default.nix74
-rw-r--r--pkgs/development/compilers/llvm/4/fix-gcc9.patch33
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/default.nix59
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/pthread_mach_thread_np.patch41
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/setup-hook.sh6
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch19
-rw-r--r--pkgs/development/compilers/llvm/4/libc++abi.nix52
-rw-r--r--pkgs/development/compilers/llvm/4/lld.nix33
-rw-r--r--pkgs/development/compilers/llvm/4/lldb-libedit.patch30
-rw-r--r--pkgs/development/compilers/llvm/4/lldb.nix63
-rw-r--r--pkgs/development/compilers/llvm/4/llvm-outputs.patch26
-rw-r--r--pkgs/development/compilers/llvm/4/llvm.nix194
-rw-r--r--pkgs/development/compilers/llvm/4/openmp.nix26
-rw-r--r--pkgs/development/compilers/llvm/4/sanitizers-nongnu.patch368
18 files changed, 0 insertions, 1254 deletions
diff --git a/pkgs/development/compilers/llvm/4/clang/0001-Fix-compilation-w-gcc9.patch b/pkgs/development/compilers/llvm/4/clang/0001-Fix-compilation-w-gcc9.patch
deleted file mode 100644
index ea9342574087..000000000000
--- a/pkgs/development/compilers/llvm/4/clang/0001-Fix-compilation-w-gcc9.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From a2af0b02eba35d0670e3e442ff7c61b3e2304edd Mon Sep 17 00:00:00 2001
-From: Maximilian Bosch <maximilian@mbosch.me>
-Date: Mon, 30 Dec 2019 02:11:35 +0100
-Subject: [PATCH] Fix compilation w/gcc9
-
-Build broken with the following errors:
-
-```
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6275:24: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6275 |       CodeGenFunction &CGF, PrePostActionTy &) {
-clang> |       ~~~~~~~~~~~~~~~~~^~~
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6321:62: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6321 |   auto &&EndThenGen = [&CGF, Device, &Info](CodeGenFunction &CGF,
-clang> |                                             ~~~~~~~~~~~~~~~~~^~~
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6400:56: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6400 |   auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-clang> |                                       ~~~~~~~~~~~~~~~~~^~~
-```
----
- lib/CodeGen/CGOpenMPRuntime.cpp | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp
-index 4025217..40a73ef 100644
---- a/lib/CodeGen/CGOpenMPRuntime.cpp
-+++ b/lib/CodeGen/CGOpenMPRuntime.cpp
-@@ -6271,7 +6271,7 @@ void CGOpenMPRuntime::emitTargetDataCalls(
-   // Generate the code for the opening of the data environment. Capture all the
-   // arguments of the runtime call by reference because they are used in the
-   // closing of the region.
--  auto &&BeginThenGen = [&D, &CGF, Device, &Info, &CodeGen, &NoPrivAction](
-+  auto &&BeginThenGen = [&D, Device, &Info, &CodeGen, &NoPrivAction](
-       CodeGenFunction &CGF, PrePostActionTy &) {
-     // Fill up the arrays with all the mapped variables.
-     MappableExprsHandler::MapBaseValuesArrayTy BasePointers;
-@@ -6318,7 +6318,7 @@ void CGOpenMPRuntime::emitTargetDataCalls(
-   };
- 
-   // Generate code for the closing of the data region.
--  auto &&EndThenGen = [&CGF, Device, &Info](CodeGenFunction &CGF,
-+  auto &&EndThenGen = [Device, &Info](CodeGenFunction &CGF,
-                                             PrePostActionTy &) {
-     assert(Info.isValid() && "Invalid data environment closing arguments.");
- 
-@@ -6397,7 +6397,7 @@ void CGOpenMPRuntime::emitTargetDataStandAloneCall(
-          "Expecting either target enter, exit data, or update directives.");
- 
-   // Generate the code for the opening of the data environment.
--  auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-+  auto &&ThenGen = [&D, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-     // Fill up the arrays with all the mapped variables.
-     MappableExprsHandler::MapBaseValuesArrayTy BasePointers;
-     MappableExprsHandler::MapValuesArrayTy Pointers;
--- 
-2.23.1
-
diff --git a/pkgs/development/compilers/llvm/4/clang/default.nix b/pkgs/development/compilers/llvm/4/clang/default.nix
deleted file mode 100644
index a90fbe6ae837..000000000000
--- a/pkgs/development/compilers/llvm/4/clang/default.nix
+++ /dev/null
@@ -1,116 +0,0 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, release_version, clang-tools-extra_src, python
-, fixDarwinDylibNames
-, enableManpages ? false
-}:
-
-let
-  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
-  self = stdenv.mkDerivation ({
-    pname = "clang";
-    inherit version;
-
-    src = fetch "cfe" "16vnv3msnvx33dydd17k2cq0icndi1a06bg5vcxkrhjjb1rqlwv1";
-
-    unpackPhase = ''
-      unpackFile $src
-      mv cfe-${version}* clang
-      sourceRoot=$PWD/clang
-      unpackFile ${clang-tools-extra_src}
-      mv clang-tools-extra-* $sourceRoot/tools/extra
-    '';
-
-    nativeBuildInputs = [ cmake python ]
-      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
-
-    buildInputs = [ libxml2 llvm ]
-      ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
-
-    cmakeFlags = [
-      "-DCMAKE_CXX_FLAGS=-std=c++11"
-    ] ++ stdenv.lib.optionals enableManpages [
-      "-DCLANG_INCLUDE_DOCS=ON"
-      "-DLLVM_ENABLE_SPHINX=ON"
-      "-DSPHINX_OUTPUT_MAN=ON"
-      "-DSPHINX_OUTPUT_HTML=OFF"
-      "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
-    ]
-    # Maybe with compiler-rt this won't be needed?
-    ++ stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}"
-    ++ stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include";
-
-    patches = [
-      ./purity.patch
-      ./0001-Fix-compilation-w-gcc9.patch
-    ];
-
-    postPatch = ''
-      sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
-      sed -i -e 's/DriverArgs.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
-    '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
-    '';
-
-    outputs = [ "out" "lib" "python" ];
-
-    # Clang expects to find LLVMgold in its own prefix
-    # Clang expects to find sanitizer libraries in its own prefix
-    postInstall = ''
-      if [ -e ${llvm}/lib/LLVMgold.so ]; then
-        ln -sv ${llvm}/lib/LLVMgold.so $out/lib
-      fi
-
-      ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/
-      ln -sv $out/bin/clang $out/bin/cpp
-
-      # Move libclang to 'lib' output
-      moveToOutput "lib/libclang.*" "$lib"
-      substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
-          --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang."
-
-      mkdir -p $python/bin $python/share/clang/
-      mv $out/bin/{git-clang-format,scan-view} $python/bin
-      if [ -e $out/bin/set-xcode-analyzer ]; then
-        mv $out/bin/set-xcode-analyzer $python/bin
-      fi
-      mv $out/share/clang/*.py $python/share/clang
-      rm $out/bin/c-index-test
-    '';
-
-    enableParallelBuilding = true;
-
-    passthru = {
-      isClang = true;
-      inherit llvm;
-    } // stdenv.lib.optionalAttrs stdenv.isLinux {
-      inherit gcc;
-    };
-
-    meta = {
-      description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
-      homepage    = http://llvm.org/;
-      license     = stdenv.lib.licenses.ncsa;
-      platforms   = stdenv.lib.platforms.all;
-    };
-  } // stdenv.lib.optionalAttrs enableManpages {
-    pname = "clang-manpages";
-
-    buildPhase = ''
-      make docs-clang-man
-    '';
-
-    installPhase = ''
-      mkdir -p $out/share/man/man1
-      # Manually install clang manpage
-      cp docs/man/*.1 $out/share/man/man1/
-    '';
-
-    outputs = [ "out" ];
-
-    doCheck = false;
-
-    meta.description = "man page for Clang ${version}";
-  });
-in self
diff --git a/pkgs/development/compilers/llvm/4/clang/purity.patch b/pkgs/development/compilers/llvm/4/clang/purity.patch
deleted file mode 100644
index f5fb4c73af47..000000000000
--- a/pkgs/development/compilers/llvm/4/clang/purity.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/lib/Driver/Tools.cpp	2016-08-25 15:48:05.187553443 +0200
-+++ b/lib/Driver/Tools.cpp	2016-08-25 15:48:47.534468882 +0200
-@@ -9420,13 +9420,6 @@
-   if (!Args.hasArg(options::OPT_static)) {
-     if (Args.hasArg(options::OPT_rdynamic))
-       CmdArgs.push_back("-export-dynamic");
--
--    if (!Args.hasArg(options::OPT_shared)) {
--      const std::string Loader =
--          D.DyldPrefix + ToolChain.getDynamicLinker(Args);
--      CmdArgs.push_back("-dynamic-linker");
--      CmdArgs.push_back(Args.MakeArgString(Loader));
--    }
-   }
- 
-   CmdArgs.push_back("-o");
diff --git a/pkgs/development/compilers/llvm/4/cmdline-help.patch b/pkgs/development/compilers/llvm/4/cmdline-help.patch
deleted file mode 100644
index a693719c2cfa..000000000000
--- a/pkgs/development/compilers/llvm/4/cmdline-help.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From c7a9aa3a697c81432786a5583bf973771c7be15e Mon Sep 17 00:00:00 2001
-From: Don Hinton <hintonda@gmail.com>
-Date: Wed, 12 Jul 2017 01:15:46 +0000
-Subject: [PATCH] Fix minor typo introduced in r276404
-
-Summary:
-A space was added between '-' and 'help' when emitting help output.
-
-See https://reviews.llvm.org/D22621 for details.
-
-Reviewers: MaggieYi, vsk
-
-Reviewed By: vsk
-
-Subscribers: llvm-commits
-
-Differential Revision: https://reviews.llvm.org/D35283
-
-git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307745 91177308-0d34-0410-b5e6-96231b3b80d8
----
- lib/Support/CommandLine.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
-index 3889902eea5..79defa5c36c 100644
---- a/lib/Support/CommandLine.cpp
-+++ b/lib/Support/CommandLine.cpp
-@@ -1236,7 +1236,7 @@ bool CommandLineParser::ParseCommandLineOptions(int argc,
-              << ": Not enough positional command line arguments specified!\n"
-              << "Must specify at least " << NumPositionalRequired
-              << " positional argument" << (NumPositionalRequired > 1 ? "s" : "")
--             << ": See: " << argv[0] << " - help\n";
-+             << ": See: " << argv[0] << " -help\n";
-     }
- 
-     ErrorParsing = true;
--- 
-2.14.0
-
diff --git a/pkgs/development/compilers/llvm/4/default.nix b/pkgs/development/compilers/llvm/4/default.nix
deleted file mode 100644
index 9651dbb72f4d..000000000000
--- a/pkgs/development/compilers/llvm/4/default.nix
+++ /dev/null
@@ -1,74 +0,0 @@
-{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
-, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
-, buildLlvmTools # tools, but from the previous stage, for cross
-, targetLlvmLibraries # libraries, but from the next stage, for cross
-}:
-
-let
-  release_version = "4.0.1";
-  version = release_version; # differentiating these is important for rc's
-
-  fetch = name: sha256: fetchurl {
-    url = "https://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
-    inherit sha256;
-  };
-
-  compiler-rt_src = fetch "compiler-rt" "0h5lpv1z554szi4r4blbskhwrkd78ir50v3ng8xvk1s86fa7gj53";
-  clang-tools-extra_src = fetch "clang-tools-extra" "1dhmp7ccfpr42bmvk3kp37ngjpf3a9m5d4kkpsn7d00hzi7fdl9m";
-
-  tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
-  in {
-
-    llvm = callPackage ./llvm.nix {
-      inherit compiler-rt_src;
-    };
-    clang-unwrapped = callPackage ./clang {
-      inherit clang-tools-extra_src;
-    };
-
-    llvm-manpages = lowPrio (tools.llvm.override {
-      enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
-    });
-
-    clang-manpages = lowPrio (tools.clang-unwrapped.override {
-      enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
-    });
-
-    libclang = tools.clang-unwrapped.lib;
-
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
-
-    libstdcxxClang = wrapCCWith {
-      cc = tools.clang-unwrapped;
-      extraPackages = [ libstdcxxHook ];
-    };
-
-    libcxxClang = wrapCCWith {
-      cc = tools.clang-unwrapped;
-      extraPackages = [ targetLlvmLibraries.libcxx targetLlvmLibraries.libcxxabi ];
-    };
-
-    lld = callPackage ./lld.nix {};
-
-    lldb = callPackage ./lldb.nix {};
-  });
-
-  libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
-  in {
-
-    stdenv = overrideCC stdenv buildLlvmTools.clang;
-
-    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
-
-    libcxx = callPackage ./libc++ {};
-
-    libcxxabi = callPackage ./libc++abi.nix {};
-
-    openmp = callPackage ./openmp.nix {};
-  });
-
-in { inherit tools libraries; } // libraries // tools
diff --git a/pkgs/development/compilers/llvm/4/fix-gcc9.patch b/pkgs/development/compilers/llvm/4/fix-gcc9.patch
deleted file mode 100644
index 8ea5ca970855..000000000000
--- a/pkgs/development/compilers/llvm/4/fix-gcc9.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-diff --git a/lib/Target/Mips/MipsFastISel.cpp b/lib/Target/Mips/MipsFastISel.cpp
-index f79cb0e6..c6279046 100644
---- a/lib/Target/Mips/MipsFastISel.cpp
-+++ b/lib/Target/Mips/MipsFastISel.cpp
-@@ -32,6 +32,7 @@
- #include "llvm/MC/MCSymbol.h"
- #include "llvm/Target/TargetInstrInfo.h"
- #include "llvm/Support/Debug.h"
-+#include <array>
- 
- #define DEBUG_TYPE "mips-fastisel"
- 
-@@ -1268,13 +1269,13 @@ bool MipsFastISel::fastLowerArguments() {
-     return false;
-   }
- 
--  const ArrayRef<MCPhysReg> GPR32ArgRegs = {Mips::A0, Mips::A1, Mips::A2,
--                                            Mips::A3};
--  const ArrayRef<MCPhysReg> FGR32ArgRegs = {Mips::F12, Mips::F14};
--  const ArrayRef<MCPhysReg> AFGR64ArgRegs = {Mips::D6, Mips::D7};
--  ArrayRef<MCPhysReg>::iterator NextGPR32 = GPR32ArgRegs.begin();
--  ArrayRef<MCPhysReg>::iterator NextFGR32 = FGR32ArgRegs.begin();
--  ArrayRef<MCPhysReg>::iterator NextAFGR64 = AFGR64ArgRegs.begin();
-+   std::array<MCPhysReg, 4> GPR32ArgRegs = {{Mips::A0, Mips::A1, Mips::A2,
-+                                            Mips::A3}};
-+   std::array<MCPhysReg, 2> FGR32ArgRegs = {{Mips::F12, Mips::F14}};
-+   std::array<MCPhysReg, 2> AFGR64ArgRegs = {{Mips::D6, Mips::D7}};
-+   auto NextGPR32 = GPR32ArgRegs.begin();
-+   auto NextFGR32 = FGR32ArgRegs.begin();
-+   auto NextAFGR64 = AFGR64ArgRegs.begin();
- 
-   struct AllocatedReg {
-     const TargetRegisterClass *RC;
diff --git a/pkgs/development/compilers/llvm/4/libc++/default.nix b/pkgs/development/compilers/llvm/4/libc++/default.nix
deleted file mode 100644
index 0213741e3e06..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++/default.nix
+++ /dev/null
@@ -1,59 +0,0 @@
-{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version }:
-
-stdenv.mkDerivation {
-  pname = "libc++";
-  inherit version;
-
-  src = fetch "libcxx" "0k6cmjcxnp2pyl8xwy1wkyyckkmdrjddim94yf1gzjbjy9qi22jj";
-
-  postUnpack = ''
-    unpackFile ${libcxxabi.src}
-    export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
-  '';
-
-  patches = [
-    # https://github.com/llvm-mirror/libcxx/commit/bcc92d75df0274b9593ebd097fcae60494e3bffc
-    ./pthread_mach_thread_np.patch
-    # glibc 2.26 fix
-    ./xlocale-glibc-2.26.patch
-  ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
-    ../../libcxx-0001-musl-hacks.patch
-    ../../libcxx-max_align_t.patch
-  ];
-
-  prePatch = ''
-    substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
-  '';
-
-  preConfigure = ''
-    # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
-    cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
-  '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-    patchShebangs utils/cat_files.py
-  '';
-  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
-
-  buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
-
-  cmakeFlags = [
-    "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
-    "-DLIBCXX_LIBCPPABI_VERSION=2"
-    "-DLIBCXX_CXX_ABI=libcxxabi"
-  ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
-
-  enableParallelBuilding = true;
-
-  linkCxxAbi = stdenv.isLinux;
-
-  setupHooks = [
-    ../../../../../build-support/setup-hooks/role.bash
-    ./setup-hook.sh
-  ];
-
-  meta = {
-    homepage = http://libcxx.llvm.org/;
-    description = "A new implementation of the C++ standard library, targeting C++11";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/libc++/pthread_mach_thread_np.patch b/pkgs/development/compilers/llvm/4/libc++/pthread_mach_thread_np.patch
deleted file mode 100644
index 8c71f1b815db..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++/pthread_mach_thread_np.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From bcc92d75df0274b9593ebd097fcae60494e3bffc Mon Sep 17 00:00:00 2001
-From: Asiri Rathnayake <asiri.rathnayake@arm.com>
-Date: Thu, 26 Jan 2017 10:40:17 +0000
-Subject: [PATCH] Fix chromium build (libcxx)
-
-Remove the reference to pthread_mach_thread_np() in libcxx headers.
-
-git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293167 91177308-0d34-0410-b5e6-96231b3b80d8
----
- include/__threading_support | 11 -----------
- 1 file changed, 11 deletions(-)
-
-diff --git a/include/__threading_support b/include/__threading_support
-index 13ab769..dfe7fe1 100644
---- a/include/__threading_support
-+++ b/include/__threading_support
-@@ -149,11 +149,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-                           void (*init_routine)(void));
- 
- // Thread id
--#if defined(__APPLE__) && !defined(__arm__)
--_LIBCPP_THREAD_ABI_VISIBILITY
--mach_port_t __libcpp_thread_get_port();
--#endif
--
- _LIBCPP_THREAD_ABI_VISIBILITY
- bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2);
- 
-@@ -297,12 +292,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
- }
- 
- // Thread id
--#if defined(__APPLE__) && !defined(__arm__)
--mach_port_t __libcpp_thread_get_port() {
--    return pthread_mach_thread_np(pthread_self());
--}
--#endif
--
- // Returns non-zero if the thread ids are equal, otherwise 0
- bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
- {
diff --git a/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh
deleted file mode 100644
index 6611259165ae..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# See pkgs/build-support/setup-hooks/role.bash
-getHostRole
-
-linkCxxAbi="@linkCxxAbi@"
-export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch b/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch
deleted file mode 100644
index e411d85066b4..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/include/__locale b/include/__locale
-index f4882de..29443b4 100644
---- a/include/__locale
-+++ b/include/__locale
-@@ -34,12 +34,12 @@
- # include <support/solaris/xlocale.h>
- #elif defined(_NEWLIB_VERSION)
- # include <support/newlib/xlocale.h>
--#elif (defined(__GLIBC__) || defined(__APPLE__)      || defined(__FreeBSD__) \
-+#elif (defined(__APPLE__)      || defined(__FreeBSD__) \
-     || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
- # include <xlocale.h>
- #elif defined(_LIBCPP_HAS_MUSL_LIBC)
- # include <support/musl/xlocale.h>
--#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
-+#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
- 
- #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
- #pragma GCC system_header
diff --git a/pkgs/development/compilers/llvm/4/libc++abi.nix b/pkgs/development/compilers/llvm/4/libc++abi.nix
deleted file mode 100644
index 8e36c5ad53a6..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++abi.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
-
-stdenv.mkDerivation {
-  pname = "libc++abi";
-  inherit version;
-
-  src = fetch "libcxxabi" "0cqvzallxh0nwiijsf6i4d5ds9m5ijfzywg7376ncv50i64if24g";
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
-
-  postUnpack = ''
-    unpackFile ${libcxx.src}
-    unpackFile ${llvm.src}
-    export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
-    export TRIPLE=x86_64-apple-darwin
-  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
-    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
-  '';
-
-  installPhase = if stdenv.isDarwin
-    then ''
-      for file in lib/*.dylib; do
-        # this should be done in CMake, but having trouble figuring out
-        # the magic combination of necessary CMake variables
-        # if you fancy a try, take a look at
-        # http://www.cmake.org/Wiki/CMake_RPATH_handling
-        install_name_tool -id $out/$file $file
-      done
-      make install
-      install -d 755 $out/include
-      install -m 644 ../include/*.h $out/include
-    ''
-    else ''
-      install -d -m 755 $out/include $out/lib
-      install -m 644 lib/libc++abi.a $out/lib
-      install -m 644 lib/libc++abi.so.1.0 $out/lib
-      install -m 644 ../include/cxxabi.h $out/include
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
-    '';
-
-  meta = {
-    homepage = http://libcxxabi.llvm.org/;
-    description = "A new implementation of low level support for a standard C++ library";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    maintainers = with stdenv.lib.maintainers; [ vlstill ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/lld.nix b/pkgs/development/compilers/llvm/4/lld.nix
deleted file mode 100644
index 3ab56677d72f..000000000000
--- a/pkgs/development/compilers/llvm/4/lld.nix
+++ /dev/null
@@ -1,33 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, llvm
-, version
-}:
-
-stdenv.mkDerivation {
-  pname = "lld";
-  inherit version;
-
-  src = fetch "lld" "1v9nkpr158j4yd4zmi6rpnfxkp78r1fapr8wji9s6v176gji1kk3";
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = [ llvm ];
-
-  outputs = [ "out" "dev" ];
-
-  enableParallelBuilding = true;
-
-  postInstall = ''
-    moveToOutput include "$dev"
-    moveToOutput lib "$dev"
-  '';
-
-  meta = {
-    description = "The LLVM Linker";
-    homepage    = http://lld.llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    platforms   = stdenv.lib.platforms.all;
-    badPlatforms = [ "x86_64-darwin" ];
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/lldb-libedit.patch b/pkgs/development/compilers/llvm/4/lldb-libedit.patch
deleted file mode 100644
index 73459ce6c864..000000000000
--- a/pkgs/development/compilers/llvm/4/lldb-libedit.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 94764369222a8e6c65420a6981d7f179a18a5417 Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Thu, 25 May 2017 15:03:42 -0500
-Subject: [PATCH] EditLine.h: libedit supports wide chars on NixOS
-
----
- include/lldb/Host/Editline.h | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/include/lldb/Host/Editline.h b/include/lldb/Host/Editline.h
-index faed373bc..b248cdee1 100644
---- a/include/lldb/Host/Editline.h
-+++ b/include/lldb/Host/Editline.h
-@@ -43,12 +43,9 @@
- // will only be
- // used in cases where this is true.  This is a compile time dependecy, for now
- // selected per target Platform
--#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
-+// (libedit on NixOS is always wide-char capable)
- #define LLDB_EDITLINE_USE_WCHAR 1
- #include <codecvt>
--#else
--#define LLDB_EDITLINE_USE_WCHAR 0
--#endif
- 
- #include "lldb/Host/ConnectionFileDescriptor.h"
- #include "lldb/lldb-private.h"
--- 
-2.13.0
-
diff --git a/pkgs/development/compilers/llvm/4/lldb.nix b/pkgs/development/compilers/llvm/4/lldb.nix
deleted file mode 100644
index 8adf11abddda..000000000000
--- a/pkgs/development/compilers/llvm/4/lldb.nix
+++ /dev/null
@@ -1,63 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, zlib
-, ncurses
-, swig
-, which
-, libedit
-, libxml2
-, llvm
-, clang-unwrapped
-, python
-, version
-, darwin
-}:
-
-stdenv.mkDerivation {
-  pname = "lldb";
-  inherit version;
-
-  src = fetch "lldb" "0yy43a27zx3r51b6gkv3v2mdiqcq3mf0ngki47ya0i30v3gx4cl4";
-
-  patches = [ ./lldb-libedit.patch ];
-  postPatch = ''
-    # Fix up various paths that assume llvm and clang are installed in the same place
-    sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
-      cmake/modules/LLDBStandalone.cmake
-    sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
-      cmake/modules/LLDBStandalone.cmake
-    sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
-      cmake/modules/LLDBStandalone.cmake
-  '';
-
-  nativeBuildInputs = [ cmake python which swig ];
-  buildInputs = [ ncurses zlib libedit libxml2 llvm ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
-
-  CXXFLAGS = "-fno-rtti";
-  hardeningDisable = [ "format" ];
-
-  cmakeFlags = [
-    "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
-  ];
-
-  # Add missing include to fix error when using std::bind
-  prePatch = ''
-    sed -i -e '30i#include <functional>' include/lldb/Utility/TaskPool.h
-  '';
-
-  enableParallelBuilding = true;
-
-  postInstall = ''
-    mkdir -p $out/share/man/man1
-    cp ../docs/lldb.1 $out/share/man/man1/
-  '';
-
-  meta = with stdenv.lib; {
-    description = "A next-generation high-performance debugger";
-    homepage    = http://llvm.org/;
-    license     = licenses.ncsa;
-    platforms   = platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/llvm-outputs.patch b/pkgs/development/compilers/llvm/4/llvm-outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/pkgs/development/compilers/llvm/4/llvm-outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix
deleted file mode 100644
index 317a5ea06f48..000000000000
--- a/pkgs/development/compilers/llvm/4/llvm.nix
+++ /dev/null
@@ -1,194 +0,0 @@
-{ stdenv
-, fetch
-, fetchpatch
-, cmake
-, python
-, libffi
-, libbfd
-, libxml2
-, ncurses
-, version
-, release_version
-, zlib
-, compiler-rt_src
-, debugVersion ? false
-, enableManpages ? false
-, enableSharedLibraries ? !enableManpages
-}:
-
-let
-  # Used when creating a versioned symlinks of libLLVM.dylib
-  versionSuffixes = with stdenv.lib;
-    let parts = splitVersion release_version; in
-    imap (i: _: concatStringsSep "." (take i parts)) parts;
-in
-
-stdenv.mkDerivation ({
-  pname = "llvm";
-  inherit version;
-
-  src = fetch "llvm" "0l9bf7kdwhlj0kq1hawpyxhna1062z3h7qcz2y8nfl9dz2qksy6s";
-
-  unpackPhase = ''
-    unpackFile $src
-    mv llvm-${version}* llvm
-    sourceRoot=$PWD/llvm
-    unpackFile ${compiler-rt_src}
-    mv compiler-rt-* $sourceRoot/projects/compiler-rt
-  '';
-
-  outputs = [ "out" ]
-    ++ stdenv.lib.optional enableSharedLibraries "lib";
-
-  nativeBuildInputs = [ cmake python ]
-    ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
-
-  buildInputs = [ libxml2 libffi ];
-
-  propagatedBuildInputs = [ ncurses zlib ];
-
-  patches = [
-    (fetchpatch {
-      name = "0001-Fix-return-type-in-ORC-readMem-client-interface.patch";
-      url = "https://bugzilla.redhat.com/attachment.cgi?id=1389687";
-      sha256 = "0ga2123aclq3x9w72d0rm0az12m8c1i4r1106vh701hf4cghgbch";
-    })
-    ./fix-gcc9.patch
-    (fetchpatch {
-      name = "llvm4-avoid-undefined-behavior-in-unittest.patch";
-      url = "https://aur.archlinux.org/cgit/aur.git/plain/D32089-Avoid-undefined-behavior-in-unittest.patch?h=llvm40&id=f459b0bad8aa3b94bc2733d79d176071a32846a6";
-      sha256 = "0x5q6a8lk6xg4ns4qh75fxvvmfnifwvyrq17ck85q8c0753i1irf";
-      extraPrefix = "";
-    })
-  ];
-
-  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
-  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
-  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
-  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
-  # a flag and turn the flag off during the stdenv build.
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
-    substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
-      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
-
-    substituteInPlace cmake/modules/AddLLVM.cmake \
-      --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
-      --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + stdenv.lib.optionalString (enableSharedLibraries) ''
-    substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
-    patch -p1 < ./llvm-outputs.patch
-  ''
-  + ''
-    (
-      cd projects/compiler-rt
-      patch -p1 < ${
-        fetchpatch {
-          name = "sigaltstack.patch"; # for glibc-2.26
-          url = https://github.com/llvm-mirror/compiler-rt/commit/8a5e425a68d.diff;
-          sha256 = "0h4y5vl74qaa7dl54b1fcyqalvlpd8zban2d1jxfkxpzyi7m8ifi";
-        }
-      }
-      substituteInPlace lib/esan/esan_sideline_linux.cpp \
-        --replace 'struct sigaltstack' 'stack_t'
-    )
-  '' + # Fix extra space printed in commandline help sometimes, "- help"
-  ''
-    patch -p1 -i ${./cmdline-help.patch}
-  '' + stdenv.lib.optionalString stdenv.isAarch64 ''
-    patch -p0 < ${../aarch64.patch}
-  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -i ${../TLI-musl.patch}
-    patch -p1 -i ${../dynamiclibrary-musl.patch}
-    patch -p1 -i ${./sanitizers-nongnu.patch} -d projects/compiler-rt
-  '';
-
-  # hacky fix: created binaries need to be run before installation
-  preBuild = ''
-    mkdir -p $out/
-    ln -sv $PWD/lib $out
-  '';
-
-  cmakeFlags = with stdenv; [
-    "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
-    "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
-    "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
-    "-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code
-
-    "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
-  ]
-  ++ stdenv.lib.optional enableSharedLibraries
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
-  ++ stdenv.lib.optionals enableManpages [
-    "-DLLVM_BUILD_DOCS=ON"
-    "-DLLVM_ENABLE_SPHINX=ON"
-    "-DSPHINX_OUTPUT_MAN=ON"
-    "-DSPHINX_OUTPUT_HTML=OFF"
-    "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
-  ]
-  ++ stdenv.lib.optional (!isDarwin)
-    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
-  ++ stdenv.lib.optionals (isDarwin) [
-    "-DLLVM_ENABLE_LIBCXX=ON"
-    "-DCAN_TARGET_i386=false"
-  ];
-
-  postBuild = ''
-    rm -fR $out
-  '';
-
-  preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
-  '';
-
-  postInstall = stdenv.lib.optionalString enableSharedLibraries ''
-    moveToOutput "lib/libLLVM-*" "$lib"
-    moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
-    substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
-  ''
-  + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
-    substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
-    ${stdenv.lib.concatMapStringsSep "\n" (v: ''
-      ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
-    '') versionSuffixes}
-  '';
-
-  doCheck = stdenv.isLinux && (!stdenv.isi686);
-
-  checkTarget = "check-all";
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "Collection of modular and reusable compiler and toolchain technologies";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    maintainers = with stdenv.lib.maintainers; [ lovek323 raskin dtzWill ];
-    platforms   = stdenv.lib.platforms.all;
-  };
-} // stdenv.lib.optionalAttrs enableManpages {
-  pname = "llvm-manpages";
-
-  buildPhase = ''
-    make docs-llvm-man
-  '';
-
-  propagatedBuildInputs = [ ];
-
-  installPhase = ''
-    make -C docs install
-  '';
-
-  outputs = [ "out" ];
-
-  doCheck = false;
-
-  meta.description = "man pages for LLVM ${version}";
-})
diff --git a/pkgs/development/compilers/llvm/4/openmp.nix b/pkgs/development/compilers/llvm/4/openmp.nix
deleted file mode 100644
index a69fe286ecc0..000000000000
--- a/pkgs/development/compilers/llvm/4/openmp.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, llvm
-, perl
-, version
-}:
-
-stdenv.mkDerivation {
-  pname = "openmp";
-  inherit version;
-
-  src = fetch "openmp" "195dykamd39yhi5az7nqj3ksqhb3wq30l93jnfkxl0061qbknsgc";
-
-  nativeBuildInputs = [ cmake perl ];
-  buildInputs = [ llvm ];
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "Components required to build an executable OpenMP program";
-    homepage    = http://openmp.llvm.org/;
-    license     = stdenv.lib.licenses.mit;
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/sanitizers-nongnu.patch b/pkgs/development/compilers/llvm/4/sanitizers-nongnu.patch
deleted file mode 100644
index 5bd858f8ae79..000000000000
--- a/pkgs/development/compilers/llvm/4/sanitizers-nongnu.patch
+++ /dev/null
@@ -1,368 +0,0 @@
-From dac4d3912378069b44340204e5fc6237aa1baf94 Mon Sep 17 00:00:00 2001
-From: Matthias Maier <tamiko@43-1.org>
-Date: Fri, 5 May 2017 17:47:39 +0000
-Subject: [PATCH] Musl patches
-
-Ported to compiler-rt-sanitizers-4.0.0. Taken from
-
-  https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch
----
- lib/asan/asan_linux.cc                             |  4 +--
- lib/interception/interception_linux.cc             |  2 +-
- lib/interception/interception_linux.h              |  2 +-
- lib/msan/msan_linux.cc                             |  2 +-
- .../sanitizer_common_interceptors_ioctl.inc        |  4 +--
- lib/sanitizer_common/sanitizer_common_syscalls.inc |  2 +-
- lib/sanitizer_common/sanitizer_linux_libcdep.cc    | 12 +++----
- lib/sanitizer_common/sanitizer_platform.h          |  7 ++++
- .../sanitizer_platform_interceptors.h              |  2 +-
- .../sanitizer_platform_limits_posix.cc             | 39 +++++++++++++---------
- lib/tsan/rtl/tsan_platform_linux.cc                |  2 +-
- 11 files changed, 46 insertions(+), 32 deletions(-)
-
-diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc
-index c051573dd..e295f6004 100644
---- a/lib/asan/asan_linux.cc
-+++ b/lib/asan/asan_linux.cc
-@@ -39,7 +39,7 @@
- #include <sys/link_elf.h>
- #endif
- 
--#if SANITIZER_ANDROID || SANITIZER_FREEBSD
-+#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_NONGNU
- #include <ucontext.h>
- extern "C" void* _DYNAMIC;
- #else
-@@ -80,7 +80,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) {
-   UNIMPLEMENTED();
- }
- 
--#if SANITIZER_ANDROID
-+#if SANITIZER_ANDROID || SANITIZER_NONGNU
- // FIXME: should we do anything for Android?
- void AsanCheckDynamicRTPrereqs() {}
- void AsanCheckIncompatibleRT() {}
-diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc
-index 6e908ac01..8f23d9adc 100644
---- a/lib/interception/interception_linux.cc
-+++ b/lib/interception/interception_linux.cc
-@@ -24,7 +24,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
-   return real == wrapper;
- }
- 
--#if !defined(__ANDROID__)  // android does not have dlvsym
-+#if !defined(__ANDROID__) && !SANITIZER_NONGNU  // android does not have dlvsym
- void *GetFuncAddrVer(const char *func_name, const char *ver) {
-   return dlvsym(RTLD_NEXT, func_name, ver);
- }
-diff --git a/lib/interception/interception_linux.h b/lib/interception/interception_linux.h
-index 27a66c882..3b559a303 100644
---- a/lib/interception/interception_linux.h
-+++ b/lib/interception/interception_linux.h
-@@ -34,7 +34,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver);
-       (::__interception::uptr) & (func),                                   \
-       (::__interception::uptr) & WRAP(func))
- 
--#if !defined(__ANDROID__)  // android does not have dlvsym
-+#if !defined(__ANDROID__) && !SANITIZER_NONGNU  // android does not have dlvsym
- #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
-   (::__interception::real_##func = (func##_f)(                \
-        unsigned long)::__interception::GetFuncAddrVer(#func, symver))
-diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc
-index 0a687f620..0852d97d7 100644
---- a/lib/msan/msan_linux.cc
-+++ b/lib/msan/msan_linux.cc
-@@ -13,7 +13,7 @@
- //===----------------------------------------------------------------------===//
- 
- #include "sanitizer_common/sanitizer_platform.h"
--#if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX && !SANITIZER_NONGNU
- 
- #include "msan.h"
- #include "msan_thread.h"
-diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-index 4ed9afedf..64f584e93 100644
---- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-+++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-@@ -100,7 +100,7 @@ static void ioctl_table_fill() {
-   _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz);
- #endif
- 
--#if SANITIZER_LINUX
-+#if SANITIZER_LINUX && !SANITIZER_NONGNU
-   // Conflicting request ids.
-   // _(CDROMAUDIOBUFSIZ, NONE, 0);
-   // _(SNDCTL_TMR_CONTINUE, NONE, 0);
-@@ -361,7 +361,7 @@ static void ioctl_table_fill() {
-   _(VT_WAITACTIVE, NONE, 0);
- #endif
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
-   _(CYGETDEFTHRESH, WRITE, sizeof(int));
-   _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
-diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc
-index 469c8eb7e..24f87867d 100644
---- a/lib/sanitizer_common/sanitizer_common_syscalls.inc
-+++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc
-@@ -2038,7 +2038,7 @@ POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) {
-   }
- }
- 
--#if !SANITIZER_ANDROID
-+#if !SANITIZER_ANDROID && !SANITIZER_NONGNU
- PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim,
-                        void *old_rlim) {
-   if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz);
-diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc
-index f99f0b594..3a773a94e 100644
---- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc
-+++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc
-@@ -152,7 +152,7 @@ bool SanitizerGetThreadName(char *name, int max_len) {
- #endif
- }
- 
--#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO
-+#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU
- static uptr g_tls_size;
- 
- #ifdef __i386__
-@@ -180,11 +180,11 @@ void InitTlsSize() {
- }
- #else
- void InitTlsSize() { }
--#endif  // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO
-+#endif  // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU
- 
- #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \
-     || defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__)) \
--    && SANITIZER_LINUX && !SANITIZER_ANDROID
-+    && SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- // sizeof(struct pthread) from glibc.
- static atomic_uintptr_t kThreadDescriptorSize;
- 
-@@ -338,7 +338,7 @@ uptr ThreadSelf() {
- 
- #if !SANITIZER_GO
- static void GetTls(uptr *addr, uptr *size) {
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- # if defined(__x86_64__) || defined(__i386__) || defined(__s390__)
-   *addr = ThreadSelf();
-   *size = GetTlsSize();
-@@ -364,7 +364,7 @@ static void GetTls(uptr *addr, uptr *size) {
-     *addr = (uptr) dtv[2];
-     *size = (*addr == 0) ? 0 : ((uptr) segbase[0] - (uptr) dtv[2]);
-   }
--#elif SANITIZER_ANDROID
-+#elif SANITIZER_ANDROID || SANITIZER_NONGNU
-   *addr = 0;
-   *size = 0;
- #else
-@@ -375,7 +375,7 @@ static void GetTls(uptr *addr, uptr *size) {
- 
- #if !SANITIZER_GO
- uptr GetTlsSize() {
--#if SANITIZER_FREEBSD || SANITIZER_ANDROID
-+#if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NONGNU
-   uptr addr, size;
-   GetTls(&addr, &size);
-   return size;
-diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h
-index d9a8e8df1..fe01c5744 100644
---- a/lib/sanitizer_common/sanitizer_platform.h
-+++ b/lib/sanitizer_common/sanitizer_platform.h
-@@ -162,6 +162,13 @@
- # define SANITIZER_PPC64V2 0
- #endif
- 
-+
-+#if defined(__linux__) && !defined(__GLIBC__)
-+# define SANITIZER_NONGNU 1
-+#else
-+# define SANITIZER_NONGNU 0
-+#endif
-+
- // By default we allow to use SizeClassAllocator64 on 64-bit platform.
- // But in some cases (e.g. AArch64's 39-bit address space) SizeClassAllocator64
- // does not work well and we need to fallback to SizeClassAllocator32.
-diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h
-index 62875d11a..212e6e882 100644
---- a/lib/sanitizer_common/sanitizer_platform_interceptors.h
-+++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h
-@@ -23,7 +23,7 @@
- # define SI_NOT_WINDOWS 0
- #endif
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- # define SI_LINUX_NOT_ANDROID 1
- #else
- # define SI_LINUX_NOT_ANDROID 0
-diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
-index 683f019d7..fd4880962 100644
---- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
-+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
-@@ -14,6 +14,8 @@
- 
- #include "sanitizer_platform.h"
- 
-+#define _LINUX_SYSINFO_H
-+
- #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC
- // Tests in this file assume that off_t-dependent data structures match the
- // libc ABI. For example, struct dirent here is what readdir() function (as
-@@ -139,12 +141,14 @@ typedef struct user_fpregs elf_fpregset_t;
- 
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
- #include <glob.h>
--#include <obstack.h>
-+#  if !SANITIZER_NONGNU
-+#    include <obstack.h>
-+#  endif
- #include <mqueue.h>
--#include <net/if_ppp.h>
--#include <netax25/ax25.h>
--#include <netipx/ipx.h>
--#include <netrom/netrom.h>
-+#include <linux/if_ppp.h>
-+#include <linux/ax25.h>
-+#include <linux/ipx.h>
-+#include <linux/netrom.h>
- #if HAVE_RPC_XDR_H
- # include <rpc/xdr.h>
- #elif HAVE_TIRPC_RPC_XDR_H
-@@ -160,7 +164,8 @@ typedef struct user_fpregs elf_fpregset_t;
- # include <sys/procfs.h>
- #endif
- #include <sys/user.h>
--#include <sys/ustat.h>
-+// #include <sys/ustat.h>
-+#include <sys/statfs.h>
- #include <linux/cyclades.h>
- #include <linux/if_eql.h>
- #include <linux/if_plip.h>
-@@ -252,7 +257,7 @@ namespace __sanitizer {
-   unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
- #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   unsigned struct_ustat_sz = sizeof(struct ustat);
-   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
-   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
-@@ -310,7 +315,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr));
- unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
- #endif
- 
--#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
-+#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   int glob_nomatch = GLOB_NOMATCH;
-   int glob_altdirfunc = GLOB_ALTDIRFUNC;
- #endif
-@@ -404,7 +409,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-   unsigned struct_termios_sz = sizeof(struct termios);
-   unsigned struct_winsize_sz = sizeof(struct winsize);
- 
--#if SANITIZER_LINUX
-+#if SANITIZER_LINUX && !SANITIZER_NONGNU
-   unsigned struct_arpreq_sz = sizeof(struct arpreq);
-   unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf);
-   unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession);
-@@ -454,7 +459,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-   unsigned struct_vt_mode_sz = sizeof(struct vt_mode);
- #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
-   unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
- #if EV_VERSION > (0x010000)
-@@ -822,7 +827,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-   unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE;
- #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
-   unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
-   unsigned IOCTL_CYGETMON = CYGETMON;
-@@ -985,7 +990,7 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr);
- CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum);
- #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
- 
--#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
-+#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- CHECK_TYPE_SIZE(glob_t);
- CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc);
- CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv);
-@@ -1019,6 +1024,7 @@ CHECK_TYPE_SIZE(iovec);
- CHECK_SIZE_AND_OFFSET(iovec, iov_base);
- CHECK_SIZE_AND_OFFSET(iovec, iov_len);
- 
-+#if !SANITIZER_NONGNU
- CHECK_TYPE_SIZE(msghdr);
- CHECK_SIZE_AND_OFFSET(msghdr, msg_name);
- CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen);
-@@ -1032,6 +1038,7 @@ CHECK_TYPE_SIZE(cmsghdr);
- CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len);
- CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
- CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
-+#endif
- 
- COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
- CHECK_SIZE_AND_OFFSET(dirent, d_ino);
-@@ -1134,7 +1141,7 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno);
- 
- CHECK_TYPE_SIZE(ether_addr);
- 
--#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
-+#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- CHECK_TYPE_SIZE(ipc_perm);
- # if SANITIZER_FREEBSD
- CHECK_SIZE_AND_OFFSET(ipc_perm, key);
-@@ -1195,7 +1202,7 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr);
- CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data);
- #endif
- 
--#if SANITIZER_LINUX
-+#if SANITIZER_LINUX && !SANITIZER_NONGNU
- COMPILER_CHECK(sizeof(__sanitizer_mallinfo) == sizeof(struct mallinfo));
- #endif
- 
-@@ -1245,7 +1252,7 @@ COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE);
- COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE);
- #endif
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE));
- CHECK_SIZE_AND_OFFSET(FILE, _flags);
- CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr);
-@@ -1264,7 +1271,7 @@ CHECK_SIZE_AND_OFFSET(FILE, _chain);
- CHECK_SIZE_AND_OFFSET(FILE, _fileno);
- #endif
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk));
- CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit);
- CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev);
-diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc
-index 3313288a7..103c7b6b9 100644
---- a/lib/tsan/rtl/tsan_platform_linux.cc
-+++ b/lib/tsan/rtl/tsan_platform_linux.cc
-@@ -287,7 +287,7 @@ void InitializePlatform() {
- // This is required to properly "close" the fds, because we do not see internal
- // closes within glibc. The code is a pure hack.
- int ExtractResolvFDs(void *state, int *fds, int nfd) {
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   int cnt = 0;
-   __res_state *statp = (__res_state*)state;
-   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
--- 
-2.16.2
-