commit
3abab98bd6
22 changed files with 1149 additions and 6 deletions
|
@ -6,7 +6,7 @@ let
|
||||||
|
|
||||||
fetch = fetch_v version;
|
fetch = fetch_v version;
|
||||||
fetch_v = ver: name: sha256: fetchurl {
|
fetch_v = ver: name: sha256: fetchurl {
|
||||||
url = "http://llvm.org/releases/${ver}/${name}-${ver}.src.tar.xz";
|
url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ let
|
||||||
|
|
||||||
fetch = fetch_v version;
|
fetch = fetch_v version;
|
||||||
fetch_v = ver: name: sha256: fetchurl {
|
fetch_v = ver: name: sha256: fetchurl {
|
||||||
url = "http://llvm.org/releases/${ver}/${name}-${ver}.src.tar.xz";
|
url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ let
|
||||||
|
|
||||||
fetch = fetch_v version;
|
fetch = fetch_v version;
|
||||||
fetch_v = ver: name: sha256: fetchurl {
|
fetch_v = ver: name: sha256: fetchurl {
|
||||||
url = "http://llvm.org/releases/${ver}/${name}-${ver}.src.tar.xz";
|
url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ let
|
||||||
|
|
||||||
fetch = fetch_v version;
|
fetch = fetch_v version;
|
||||||
fetch_v = ver: name: sha256: fetchurl {
|
fetch_v = ver: name: sha256: fetchurl {
|
||||||
url = "http://llvm.org/releases/${version}/${name}-${ver}.src.tar.xz";
|
url = "https://releases.llvm.org/${version}/${name}-${ver}.src.tar.xz";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ let
|
||||||
version = release_version; # differentiating these is important for rc's
|
version = release_version; # differentiating these is important for rc's
|
||||||
|
|
||||||
fetch = name: sha256: fetchurl {
|
fetch = name: sha256: fetchurl {
|
||||||
url = "http://llvm.org/releases/${release_version}/${name}-${version}.src.tar.xz";
|
url = "https://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ let
|
||||||
version = release_version; # differentiating these is important for rc's
|
version = release_version; # differentiating these is important for rc's
|
||||||
|
|
||||||
fetch = name: sha256: fetchurl {
|
fetch = name: sha256: fetchurl {
|
||||||
url = "http://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
|
url = "https://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
106
pkgs/development/compilers/llvm/7/clang/default.nix
Normal file
106
pkgs/development/compilers/llvm/7/clang/default.nix
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
{ stdenv, fetch, cmake, libxml2, llvm, 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 ({
|
||||||
|
name = "clang-${version}";
|
||||||
|
|
||||||
|
unpackPhase = ''
|
||||||
|
unpackFile ${fetch "cfe" "0mdsbgj3p7mayhzm8hclzl3i46r2lwa8fr1cz399f9km3iqi40jm"}
|
||||||
|
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"
|
||||||
|
];
|
||||||
|
|
||||||
|
patches = [ ./purity.patch ];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
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
|
||||||
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
|
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||||
|
'';
|
||||||
|
|
||||||
|
outputs = [ "out" "lib" "python" ];
|
||||||
|
|
||||||
|
# Clang expects to find LLVMgold in its own prefix
|
||||||
|
postInstall = ''
|
||||||
|
if [ -e ${llvm}/lib/LLVMgold.so ]; then
|
||||||
|
ln -sv ${llvm}/lib/LLVMgold.so $out/lib
|
||||||
|
fi
|
||||||
|
|
||||||
|
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.targetPlatform.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 {
|
||||||
|
name = "clang-manpages-${version}";
|
||||||
|
|
||||||
|
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
|
30
pkgs/development/compilers/llvm/7/clang/purity.patch
Normal file
30
pkgs/development/compilers/llvm/7/clang/purity.patch
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Will Dietz <w@wdtz.org>
|
||||||
|
Date: Thu, 18 May 2017 11:56:12 -0500
|
||||||
|
Subject: [PATCH] "purity" patch for 5.0
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/Driver/ToolChains/Gnu.cpp | 7 -------
|
||||||
|
1 file changed, 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
|
||||||
|
index fe3c0191bb..c6a482bece 100644
|
||||||
|
--- a/lib/Driver/ToolChains/Gnu.cpp
|
||||||
|
+++ b/lib/Driver/ToolChains/Gnu.cpp
|
||||||
|
@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
|
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");
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
33
pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch
Normal file
33
pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Will Dietz <w@wdtz.org>
|
||||||
|
Date: Tue, 19 Sep 2017 13:13:06 -0500
|
||||||
|
Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that
|
||||||
|
needs it
|
||||||
|
|
||||||
|
---
|
||||||
|
cmake/Modules/AddCompilerRT.cmake | 8 ------
|
||||||
|
test/asan/CMakeLists.txt | 52 ---------------------------------------
|
||||||
|
test/tsan/CMakeLists.txt | 47 -----------------------------------
|
||||||
|
3 files changed, 107 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
|
||||||
|
index bc5fb9ff7..b64eb4246 100644
|
||||||
|
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||||
|
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||||
|
@@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type)
|
||||||
|
set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
|
||||||
|
set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")
|
||||||
|
endif()
|
||||||
|
- if(APPLE)
|
||||||
|
- # Ad-hoc sign the dylibs
|
||||||
|
- add_custom_command(TARGET ${libname}
|
||||||
|
- POST_BUILD
|
||||||
|
- COMMAND codesign --sign - $<TARGET_FILE:${libname}>
|
||||||
|
- WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
|
||||||
|
- )
|
||||||
|
- endif()
|
||||||
|
endif()
|
||||||
|
install(TARGETS ${libname}
|
||||||
|
ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}
|
||||||
|
2.14.1
|
||||||
|
|
37
pkgs/development/compilers/llvm/7/compiler-rt.nix
Normal file
37
pkgs/development/compilers/llvm/7/compiler-rt.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
|
||||||
|
with stdenv.lib;
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "compiler-rt-${version}";
|
||||||
|
inherit version;
|
||||||
|
src = fetch "compiler-rt" "1mkhqvs8cxbfmprkzwyq7lmnzr1sv45znzf0arbgb19crzipzv5x";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake python llvm ];
|
||||||
|
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||||
|
|
||||||
|
configureFlags = [
|
||||||
|
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||||
|
];
|
||||||
|
|
||||||
|
outputs = [ "out" "dev" ];
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||||
|
] ++ optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch;
|
||||||
|
|
||||||
|
# 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 cmake/config-ix.cmake \
|
||||||
|
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Hack around weird upsream RPATH bug
|
||||||
|
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
ln -s "$out/lib"/*/* "$out/lib"
|
||||||
|
'';
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
}
|
92
pkgs/development/compilers/llvm/7/default.nix
Normal file
92
pkgs/development/compilers/llvm/7/default.nix
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
{ 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 = "7.0.0";
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
clang-tools-extra_src = fetch "clang-tools-extra" "1glxl7bnr4k3j16s8xy8r9cl0llyg524f50591g1ig23ij65lz4k";
|
||||||
|
|
||||||
|
tools = stdenv.lib.makeExtensible (tools: let
|
||||||
|
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
|
||||||
|
mkExtraBuildCommands = cc: ''
|
||||||
|
rsrc="$out/resource-root"
|
||||||
|
mkdir "$rsrc"
|
||||||
|
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||||
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||||
|
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||||
|
'' + stdenv.lib.optionalString stdenv.targetPlatform.isLinux ''
|
||||||
|
echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
|
||||||
|
llvm = callPackage ./llvm.nix { };
|
||||||
|
|
||||||
|
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 rec {
|
||||||
|
cc = tools.clang-unwrapped;
|
||||||
|
extraPackages = [
|
||||||
|
libstdcxxHook
|
||||||
|
targetLlvmLibraries.compiler-rt
|
||||||
|
];
|
||||||
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
|
};
|
||||||
|
|
||||||
|
libcxxClang = wrapCCWith rec {
|
||||||
|
cc = tools.clang-unwrapped;
|
||||||
|
extraPackages = [
|
||||||
|
targetLlvmLibraries.libcxx
|
||||||
|
targetLlvmLibraries.libcxxabi
|
||||||
|
targetLlvmLibraries.compiler-rt
|
||||||
|
];
|
||||||
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 {
|
||||||
|
|
||||||
|
compiler-rt = callPackage ./compiler-rt.nix {};
|
||||||
|
|
||||||
|
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
|
50
pkgs/development/compilers/llvm/7/libc++/default.nix
Normal file
50
pkgs/development/compilers/llvm/7/libc++/default.nix
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "libc++-${version}";
|
||||||
|
|
||||||
|
src = fetch "libcxx" "1w1l472p03csgz76p70pn9yk7h0nw5hj1av44ysnakigp8jjcd4v";
|
||||||
|
|
||||||
|
postUnpack = ''
|
||||||
|
unpackFile ${libcxxabi.src}
|
||||||
|
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
||||||
|
'';
|
||||||
|
|
||||||
|
patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.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;
|
||||||
|
};
|
||||||
|
}
|
6
pkgs/development/compilers/llvm/7/libc++/setup-hook.sh
Normal file
6
pkgs/development/compilers/llvm/7/libc++/setup-hook.sh
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# 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"}"
|
49
pkgs/development/compilers/llvm/7/libc++abi.nix
Normal file
49
pkgs/development/compilers/llvm/7/libc++abi.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "libc++abi-${version}";
|
||||||
|
|
||||||
|
src = fetch "libcxxabi" "0pr4xfx61r5mwmvhg4j9pb6df6vvha1gyf6rwkm14x9rzxcwficv";
|
||||||
|
|
||||||
|
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}
|
||||||
|
'';
|
||||||
|
|
||||||
|
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.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;
|
||||||
|
};
|
||||||
|
}
|
32
pkgs/development/compilers/llvm/7/lld.nix
Normal file
32
pkgs/development/compilers/llvm/7/lld.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{ stdenv
|
||||||
|
, fetch
|
||||||
|
, cmake
|
||||||
|
, libxml2
|
||||||
|
, llvm
|
||||||
|
, version
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "lld-${version}";
|
||||||
|
|
||||||
|
src = fetch "lld" "173z50vx5mlsaiqmbz7asxy2297z4xivrfxrdfncvx23wp2lgkzv";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake ];
|
||||||
|
buildInputs = [ llvm libxml2 ];
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
}
|
56
pkgs/development/compilers/llvm/7/lldb.nix
Normal file
56
pkgs/development/compilers/llvm/7/lldb.nix
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{ stdenv
|
||||||
|
, fetch
|
||||||
|
, cmake
|
||||||
|
, zlib
|
||||||
|
, ncurses
|
||||||
|
, swig
|
||||||
|
, which
|
||||||
|
, libedit
|
||||||
|
, libxml2
|
||||||
|
, llvm
|
||||||
|
, clang-unwrapped
|
||||||
|
, python
|
||||||
|
, version
|
||||||
|
, darwin
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "lldb-${version}";
|
||||||
|
|
||||||
|
src = fetch "lldb" "0cmah36ybyfws0z2ikq9fqn5k4kvjci7vgk97ddx4xwrwkzdixkz";
|
||||||
|
|
||||||
|
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
|
||||||
|
];
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
}
|
26
pkgs/development/compilers/llvm/7/llvm-outputs.patch
Normal file
26
pkgs/development/compilers/llvm/7/llvm-outputs.patch
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
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,
|
174
pkgs/development/compilers/llvm/7/llvm.nix
Normal file
174
pkgs/development/compilers/llvm/7/llvm.nix
Normal file
|
@ -0,0 +1,174 @@
|
||||||
|
{ stdenv
|
||||||
|
, fetch
|
||||||
|
, cmake
|
||||||
|
, python
|
||||||
|
, libffi
|
||||||
|
, libbfd
|
||||||
|
, libpfm
|
||||||
|
, libxml2
|
||||||
|
, ncurses
|
||||||
|
, version
|
||||||
|
, release_version
|
||||||
|
, zlib
|
||||||
|
, debugVersion ? false
|
||||||
|
, enableManpages ? false
|
||||||
|
, enableSharedLibraries ? true
|
||||||
|
, enableWasm ? true
|
||||||
|
, enablePFM ? !stdenv.isDarwin
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
src = fetch "llvm" "08p27wv1pr9ql2zc3f3qkkymci46q7myvh8r5ijippnbwr2gihcb";
|
||||||
|
|
||||||
|
# Used when creating a version-suffixed symlink of libLLVM.dylib
|
||||||
|
shortVersion = with stdenv.lib;
|
||||||
|
concatStringsSep "." (take 1 (splitString "." release_version));
|
||||||
|
in stdenv.mkDerivation (rec {
|
||||||
|
name = "llvm-${version}";
|
||||||
|
|
||||||
|
unpackPhase = ''
|
||||||
|
unpackFile ${src}
|
||||||
|
mv llvm-${version}* llvm
|
||||||
|
sourceRoot=$PWD/llvm
|
||||||
|
'';
|
||||||
|
|
||||||
|
outputs = [ "out" "python" ]
|
||||||
|
++ stdenv.lib.optional enableSharedLibraries "lib";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake python ]
|
||||||
|
++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
|
||||||
|
|
||||||
|
buildInputs = [ libxml2 libffi ]
|
||||||
|
++ stdenv.lib.optional enablePFM libpfm; # exegesis
|
||||||
|
|
||||||
|
propagatedBuildInputs = [ ncurses zlib ];
|
||||||
|
|
||||||
|
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
substituteInPlace cmake/modules/AddLLVM.cmake \
|
||||||
|
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir INSTALL_NAME_DIR "$lib/lib")" \
|
||||||
|
--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
|
||||||
|
'' + ''
|
||||||
|
# FileSystem permissions tests fail with various special bits
|
||||||
|
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||||
|
--replace "Path.cpp" ""
|
||||||
|
rm unittests/Support/Path.cpp
|
||||||
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
|
patch -p1 -i ${../TLI-musl.patch}
|
||||||
|
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||||
|
--replace "add_subdirectory(DynamicLibrary)" ""
|
||||||
|
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
|
||||||
|
'' + ''
|
||||||
|
patchShebangs test/BugPoint/compile-custom.ll.py
|
||||||
|
'';
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
||||||
|
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
|
||||||
|
"-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
|
||||||
|
|
||||||
|
"-DLLVM_ENABLE_DUMP=ON"
|
||||||
|
]
|
||||||
|
++ 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"
|
||||||
|
]
|
||||||
|
++ stdenv.lib.optional enableWasm
|
||||||
|
"-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly"
|
||||||
|
;
|
||||||
|
|
||||||
|
postBuild = ''
|
||||||
|
rm -fR $out
|
||||||
|
|
||||||
|
paxmark m bin/{lli,llvm-rtdyld}
|
||||||
|
paxmark m unittests/ExecutionEngine/MCJIT/MCJITTests
|
||||||
|
paxmark m unittests/ExecutionEngine/Orc/OrcJITTests
|
||||||
|
paxmark m unittests/Support/SupportTests
|
||||||
|
paxmark m bin/lli-child-target
|
||||||
|
'';
|
||||||
|
|
||||||
|
preCheck = ''
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p $python/share
|
||||||
|
mv $out/share/opt-viewer $python/share/opt-viewer
|
||||||
|
''
|
||||||
|
+ 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"
|
||||||
|
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
|
||||||
|
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
|
||||||
|
'';
|
||||||
|
|
||||||
|
doCheck = stdenv.isLinux && (!stdenv.isi686);
|
||||||
|
|
||||||
|
checkTarget = "check-all";
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
passthru.src = src;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
name = "llvm-manpages-${version}";
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
make docs-llvm-man
|
||||||
|
'';
|
||||||
|
|
||||||
|
propagatedBuildInputs = [];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
make -C docs install
|
||||||
|
'';
|
||||||
|
|
||||||
|
postPatch = null;
|
||||||
|
postInstall = null;
|
||||||
|
|
||||||
|
outputs = [ "out" ];
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
meta.description = "man pages for LLVM ${version}";
|
||||||
|
})
|
25
pkgs/development/compilers/llvm/7/openmp.nix
Normal file
25
pkgs/development/compilers/llvm/7/openmp.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ stdenv
|
||||||
|
, fetch
|
||||||
|
, cmake
|
||||||
|
, llvm
|
||||||
|
, perl
|
||||||
|
, version
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "openmp-${version}";
|
||||||
|
|
||||||
|
src = fetch "openmp" "1zrqlaxr954sp8lcr7g8m0z0pr8xyq4i6p11x6gcamjm5xijnrih";
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
}
|
413
pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch
Normal file
413
pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch
Normal file
|
@ -0,0 +1,413 @@
|
||||||
|
From 7b4b3333a2718628b1d510ec1d8438ad67308299 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Will Dietz <w@wdtz.org>
|
||||||
|
Date: Fri, 29 Jun 2018 09:48:59 -0500
|
||||||
|
Subject: [PATCH] Ported to 6.0, taken from gentoo-musl project.
|
||||||
|
|
||||||
|
------
|
||||||
|
Ported to compiler-rt-sanitizers-5.0.0. Taken from
|
||||||
|
|
||||||
|
https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch
|
||||||
|
Signed-off-by: Jory A. Pratt <anarchy@gentoo.org>
|
||||||
|
|
||||||
|
Taken from gentoo-musl project, with a few additional minor fixes.
|
||||||
|
---
|
||||||
|
lib/asan/asan_linux.cc | 4 +-
|
||||||
|
lib/interception/interception_linux.cc | 2 +-
|
||||||
|
lib/interception/interception_linux.h | 3 +-
|
||||||
|
lib/msan/msan_linux.cc | 2 +-
|
||||||
|
lib/sanitizer_common/sanitizer_allocator.cc | 2 +-
|
||||||
|
.../sanitizer_common_interceptors_ioctl.inc | 4 +-
|
||||||
|
.../sanitizer_common_syscalls.inc | 2 +-
|
||||||
|
lib/sanitizer_common/sanitizer_linux.cc | 8 +++-
|
||||||
|
.../sanitizer_linux_libcdep.cc | 10 ++---
|
||||||
|
lib/sanitizer_common/sanitizer_platform.h | 6 +++
|
||||||
|
.../sanitizer_platform_interceptors.h | 4 +-
|
||||||
|
.../sanitizer_platform_limits_posix.cc | 37 +++++++++++--------
|
||||||
|
lib/tsan/rtl/tsan_platform_linux.cc | 2 +-
|
||||||
|
13 files changed, 51 insertions(+), 35 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc
|
||||||
|
index 625f32d40..73cf77aca 100644
|
||||||
|
--- a/lib/asan/asan_linux.cc
|
||||||
|
+++ b/lib/asan/asan_linux.cc
|
||||||
|
@@ -46,7 +46,7 @@
|
||||||
|
#include <link.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS
|
||||||
|
+#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS || SANITIZER_NONGNU
|
||||||
|
#include <ucontext.h>
|
||||||
|
extern "C" void* _DYNAMIC;
|
||||||
|
#elif SANITIZER_NETBSD
|
||||||
|
@@ -139,7 +139,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 c991550a4..2b706418b 100644
|
||||||
|
--- a/lib/interception/interception_linux.cc
|
||||||
|
+++ b/lib/interception/interception_linux.cc
|
||||||
|
@@ -43,7 +43,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Android and Solaris do not have dlvsym
|
||||||
|
-#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS
|
||||||
|
+#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_NONGNU
|
||||||
|
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 98fe51b85..c13302b98 100644
|
||||||
|
--- a/lib/interception/interception_linux.h
|
||||||
|
+++ b/lib/interception/interception_linux.h
|
||||||
|
@@ -35,8 +35,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver);
|
||||||
|
(::__interception::uptr) & (func), \
|
||||||
|
(::__interception::uptr) & WRAP(func))
|
||||||
|
|
||||||
|
-// Android and Solaris do not have dlvsym
|
||||||
|
-#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS
|
||||||
|
+#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_NONGNU
|
||||||
|
#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 4e6321fcb..4d50feb82 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 || SANITIZER_NETBSD
|
||||||
|
+#if SANITIZER_FREEBSD || (SANITIZER_LINUX && !SANITIZER_NONGNU) || SANITIZER_NETBSD
|
||||||
|
|
||||||
|
#include "msan.h"
|
||||||
|
#include "msan_thread.h"
|
||||||
|
diff --git a/lib/sanitizer_common/sanitizer_allocator.cc b/lib/sanitizer_common/sanitizer_allocator.cc
|
||||||
|
index fc4f7a75a..76cf4f769 100644
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_allocator.cc
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_allocator.cc
|
||||||
|
@@ -23,7 +23,7 @@ namespace __sanitizer {
|
||||||
|
|
||||||
|
// ThreadSanitizer for Go uses libc malloc/free.
|
||||||
|
#if SANITIZER_GO || defined(SANITIZER_USE_MALLOC)
|
||||||
|
-# if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
|
+# if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
|
||||||
|
extern "C" void *__libc_malloc(uptr size);
|
||||||
|
# if !SANITIZER_GO
|
||||||
|
extern "C" void *__libc_memalign(uptr alignment, uptr size);
|
||||||
|
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
|
||||||
|
index 24e7548a5..20259b1d6 100644
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
|
||||||
|
@@ -102,7 +102,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);
|
||||||
|
@@ -363,7 +363,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.cc b/lib/sanitizer_common/sanitizer_linux.cc
|
||||||
|
index 6c83e8db4..542c4fe64 100644
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_linux.cc
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_linux.cc
|
||||||
|
@@ -522,13 +522,13 @@ const char *GetEnv(const char *name) {
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
-#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
|
||||||
|
+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD && !SANITIZER_NONGNU
|
||||||
|
extern "C" {
|
||||||
|
SANITIZER_WEAK_ATTRIBUTE extern void *__libc_stack_end;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if !SANITIZER_GO && !SANITIZER_FREEBSD && !SANITIZER_NETBSD
|
||||||
|
+#if (!SANITIZER_GO || SANITIZER_NONGNU) && !SANITIZER_FREEBSD && !SANITIZER_NETBSD
|
||||||
|
static void ReadNullSepFileToArray(const char *path, char ***arr,
|
||||||
|
int arr_size) {
|
||||||
|
char *buff;
|
||||||
|
@@ -569,6 +569,10 @@ static void GetArgsAndEnv(char ***argv, char ***envp) {
|
||||||
|
#elif SANITIZER_NETBSD
|
||||||
|
*argv = __ps_strings->ps_argvstr;
|
||||||
|
*argv = __ps_strings->ps_envstr;
|
||||||
|
+#elif SANITIZER_NONGNU
|
||||||
|
+ static const int kMaxArgv = 2000, kMaxEnvp = 2000;
|
||||||
|
+ ReadNullSepFileToArray("/proc/self/cmdline", argv, kMaxArgv);
|
||||||
|
+ ReadNullSepFileToArray("/proc/self/environ", envp, kMaxEnvp);
|
||||||
|
#else
|
||||||
|
#if !SANITIZER_GO
|
||||||
|
if (&__libc_stack_end) {
|
||||||
|
diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc
|
||||||
|
index 56fdfc870..a932d5db1 100644
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc
|
||||||
|
@@ -174,7 +174,7 @@ bool SanitizerGetThreadName(char *name, int max_len) {
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && \
|
||||||
|
- !SANITIZER_NETBSD && !SANITIZER_SOLARIS
|
||||||
|
+ !SANITIZER_NETBSD && !SANITIZER_SOLARIS && !SANITIZER_NONGNU
|
||||||
|
static uptr g_tls_size;
|
||||||
|
|
||||||
|
#ifdef __i386__
|
||||||
|
@@ -207,7 +207,7 @@ void InitTlsSize() { }
|
||||||
|
|
||||||
|
#if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \
|
||||||
|
|| defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__) \
|
||||||
|
- || defined(__arm__)) && SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
|
+ || defined(__arm__)) && SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
|
||||||
|
// sizeof(struct pthread) from glibc.
|
||||||
|
static atomic_uintptr_t kThreadDescriptorSize;
|
||||||
|
|
||||||
|
@@ -391,7 +391,7 @@ int GetSizeFromHdr(struct dl_phdr_info *info, size_t size, void *data) {
|
||||||
|
|
||||||
|
#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();
|
||||||
|
@@ -432,7 +432,7 @@ static void GetTls(uptr *addr, uptr *size) {
|
||||||
|
*addr = (uptr)tcb->tcb_dtv[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-#elif SANITIZER_ANDROID
|
||||||
|
+#elif SANITIZER_ANDROID || SANITIZER_NONGNU
|
||||||
|
*addr = 0;
|
||||||
|
*size = 0;
|
||||||
|
#elif SANITIZER_SOLARIS
|
||||||
|
@@ -448,7 +448,7 @@ static void GetTls(uptr *addr, uptr *size) {
|
||||||
|
#if !SANITIZER_GO
|
||||||
|
uptr GetTlsSize() {
|
||||||
|
#if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NETBSD || \
|
||||||
|
- SANITIZER_SOLARIS
|
||||||
|
+ SANITIZER_SOLARIS || 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 334903c26..fc2afac2c 100644
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_platform.h
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_platform.h
|
||||||
|
@@ -195,6 +195,12 @@
|
||||||
|
# define SANITIZER_SOLARIS32 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 b99ac4480..628d226a1 100644
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_platform_interceptors.h
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h
|
||||||
|
@@ -38,7 +38,7 @@
|
||||||
|
# include "sanitizer_platform_limits_solaris.h"
|
||||||
|
#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
|
||||||
|
@@ -291,7 +291,7 @@
|
||||||
|
(SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
||||||
|
#define SANITIZER_INTERCEPT_ETHER_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
|
||||||
|
#define SANITIZER_INTERCEPT_SHMCTL \
|
||||||
|
- (SI_NETBSD || SI_SOLARIS || ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && \
|
||||||
|
+ (SI_NETBSD || SI_SOLARIS || ((SI_FREEBSD || SI_LINUX_NOT_ANDROID || SANITIZER_NONGNU) && \
|
||||||
|
SANITIZER_WORDSIZE == 64)) // NOLINT
|
||||||
|
#define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID
|
||||||
|
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX
|
||||||
|
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
|
||||||
|
index feb7bad6f..4e89ab2a6 100644
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
|
||||||
|
@@ -14,6 +14,9 @@
|
||||||
|
|
||||||
|
#include "sanitizer_platform.h"
|
||||||
|
|
||||||
|
+// Workaround musl <--> linux conflicting definition of 'struct sysinfo'
|
||||||
|
+#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
|
||||||
|
@@ -138,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
|
||||||
|
@@ -251,7 +256,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
|
||||||
|
// Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
|
||||||
|
// has been removed from glibc 2.28.
|
||||||
|
#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
|
||||||
|
@@ -322,7 +327,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
|
||||||
|
@@ -416,7 +421,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);
|
||||||
|
@@ -466,7 +471,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)
|
||||||
|
@@ -834,7 +839,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;
|
||||||
|
@@ -989,7 +994,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);
|
||||||
|
@@ -1023,6 +1028,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);
|
||||||
|
@@ -1036,6 +1042,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);
|
||||||
|
@@ -1138,7 +1145,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);
|
||||||
|
@@ -1199,7 +1206,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
|
||||||
|
|
||||||
|
@@ -1249,7 +1256,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);
|
||||||
|
@@ -1268,7 +1275,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 e14d5f575..389a3bc88 100644
|
||||||
|
--- a/lib/tsan/rtl/tsan_platform_linux.cc
|
||||||
|
+++ b/lib/tsan/rtl/tsan_platform_linux.cc
|
||||||
|
@@ -285,7 +285,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;
|
||||||
|
struct __res_state *statp = (struct __res_state*)state;
|
||||||
|
for (int i = 0; i < MAXNS && cnt < nfd; i++) {
|
||||||
|
--
|
||||||
|
2.18.0
|
||||||
|
|
|
@ -17,6 +17,8 @@ with pkgs;
|
||||||
cc-wrapper-libcxx-5 = callPackage ./cc-wrapper { stdenv = llvmPackages_5.libcxxStdenv; };
|
cc-wrapper-libcxx-5 = callPackage ./cc-wrapper { stdenv = llvmPackages_5.libcxxStdenv; };
|
||||||
cc-wrapper-clang-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.stdenv; };
|
cc-wrapper-clang-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.stdenv; };
|
||||||
cc-wrapper-libcxx-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.libcxxStdenv; };
|
cc-wrapper-libcxx-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.libcxxStdenv; };
|
||||||
|
cc-wrapper-clang-7 = callPackage ./cc-wrapper { stdenv = llvmPackages_7.stdenv; };
|
||||||
|
cc-wrapper-libcxx-7 = callPackage ./cc-wrapper { stdenv = llvmPackages_7.libcxxStdenv; };
|
||||||
stdenv-inputs = callPackage ./stdenv-inputs { };
|
stdenv-inputs = callPackage ./stdenv-inputs { };
|
||||||
|
|
||||||
cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; };
|
cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; };
|
||||||
|
|
|
@ -6381,6 +6381,7 @@ with pkgs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
clang_7 = llvmPackages_7.clang;
|
||||||
clang_6 = llvmPackages_6.clang;
|
clang_6 = llvmPackages_6.clang;
|
||||||
clang_5 = llvmPackages_5.clang;
|
clang_5 = llvmPackages_5.clang;
|
||||||
clang_4 = llvmPackages_4.clang;
|
clang_4 = llvmPackages_4.clang;
|
||||||
|
@ -6978,15 +6979,18 @@ with pkgs;
|
||||||
lld_4 = llvmPackages_4.lld;
|
lld_4 = llvmPackages_4.lld;
|
||||||
lld_5 = llvmPackages_5.lld;
|
lld_5 = llvmPackages_5.lld;
|
||||||
lld_6 = llvmPackages_6.lld;
|
lld_6 = llvmPackages_6.lld;
|
||||||
|
lld_7 = llvmPackages_7.lld;
|
||||||
|
|
||||||
lldb = llvmPackages.lldb;
|
lldb = llvmPackages.lldb;
|
||||||
lldb_4 = llvmPackages_4.lldb;
|
lldb_4 = llvmPackages_4.lldb;
|
||||||
lldb_5 = llvmPackages_5.lldb;
|
lldb_5 = llvmPackages_5.lldb;
|
||||||
lldb_6 = llvmPackages_6.lldb;
|
lldb_6 = llvmPackages_6.lldb;
|
||||||
|
lldb_7 = llvmPackages_7.lldb;
|
||||||
|
|
||||||
llvm = llvmPackages.llvm;
|
llvm = llvmPackages.llvm;
|
||||||
llvm-manpages = llvmPackages.llvm-manpages;
|
llvm-manpages = llvmPackages.llvm-manpages;
|
||||||
|
|
||||||
|
llvm_7 = llvmPackages_7.llvm;
|
||||||
llvm_6 = llvmPackages_6.llvm;
|
llvm_6 = llvmPackages_6.llvm;
|
||||||
llvm_5 = llvmPackages_5.llvm;
|
llvm_5 = llvmPackages_5.llvm;
|
||||||
llvm_4 = llvmPackages_4.llvm;
|
llvm_4 = llvmPackages_4.llvm;
|
||||||
|
@ -7051,6 +7055,14 @@ with pkgs;
|
||||||
stdenv = overrideCC stdenv buildPackages.gcc6; # with gcc-7: undefined reference to `__divmoddi4'
|
stdenv = overrideCC stdenv buildPackages.gcc6; # with gcc-7: undefined reference to `__divmoddi4'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
llvmPackages_7 = callPackage ../development/compilers/llvm/7 ({
|
||||||
|
inherit (stdenvAdapters) overrideCC;
|
||||||
|
buildLlvmTools = buildPackages.llvmPackages_7.tools;
|
||||||
|
targetLlvmLibraries = targetPackages.llvmPackages_7.libraries;
|
||||||
|
} // stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
|
||||||
|
stdenv = overrideCC stdenv buildPackages.gcc6; # with gcc-7: undefined reference to `__divmoddi4'
|
||||||
|
});
|
||||||
|
|
||||||
manticore = callPackage ../development/compilers/manticore { };
|
manticore = callPackage ../development/compilers/manticore { };
|
||||||
|
|
||||||
mentorToolchains = recurseIntoAttrs (
|
mentorToolchains = recurseIntoAttrs (
|
||||||
|
|
Loading…
Reference in a new issue