diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5')
16 files changed, 1391 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/clang/default.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/clang/default.nix new file mode 100644 index 000000000000..b5e7b54fa5be --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/clang/default.nix @@ -0,0 +1,107 @@ +{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3 +, fixDarwinDylibNames +, enableManpages ? false +}: + +let + self = stdenv.mkDerivation ({ + pname = "clang"; + inherit version; + + src = fetch "cfe" "0018520c4qxf5hgjdqgpz2dgl3faf4gsz87fdlb8zdmx99rfk77s"; + + unpackPhase = '' + unpackFile $src + mv cfe-${version}* clang + sourceRoot=$PWD/clang + unpackFile ${clang-tools-extra_src} + mv clang-tools-extra-* $sourceRoot/tools/extra + ''; + + nativeBuildInputs = [ cmake python3 ] + ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx + ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; + + buildInputs = [ libxml2 llvm ]; + + cmakeFlags = [ + "-DCMAKE_CXX_FLAGS=-std=c++11" + "-DLLVM_ENABLE_RTTI=ON" + ] ++ 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; + }; + + meta = { + description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler"; + homepage = "https://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/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/clang/purity.patch b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/clang/purity.patch new file mode 100644 index 000000000000..b30d0d0b5d5b --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/clang/purity.patch @@ -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 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-armv7l.patch b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-armv7l.patch new file mode 100644 index 000000000000..77bf2640c477 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-armv7l.patch @@ -0,0 +1,23 @@ +diff -ur compiler-rt-5.0.2.src/cmake/builtin-config-ix.cmake compiler-rt-5.0.2.src-patched/cmake/builtin-config-ix.cmake +--- compiler-rt-5.0.2.src/cmake/builtin-config-ix.cmake 2017-05-25 00:53:24.000000000 +0900 ++++ compiler-rt-5.0.2.src-patched/cmake/builtin-config-ix.cmake 2020-05-10 03:24:24.937433155 +0900 +@@ -24,7 +24,7 @@ + + + set(ARM64 aarch64) +-set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k) ++set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l) + set(X86 i386 i686) + set(X86_64 x86_64) + set(MIPS32 mips mipsel) +diff -ur compiler-rt-5.0.2.src/lib/builtins/CMakeLists.txt compiler-rt-5.0.2.src-patched/lib/builtins/CMakeLists.txt +--- compiler-rt-5.0.2.src/lib/builtins/CMakeLists.txt 2017-07-13 04:33:30.000000000 +0900 ++++ compiler-rt-5.0.2.src-patched/lib/builtins/CMakeLists.txt 2020-05-10 03:24:45.945075423 +0900 +@@ -444,6 +444,7 @@ + set(armv7_SOURCES ${arm_SOURCES}) + set(armv7s_SOURCES ${arm_SOURCES}) + set(armv7k_SOURCES ${arm_SOURCES}) ++set(armv7l_SOURCES ${arm_SOURCES}) + set(arm64_SOURCES ${aarch64_SOURCES}) + + # macho_embedded archs diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-codesign.patch b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-codesign.patch new file mode 100644 index 000000000000..8f4c76bca1eb --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-codesign.patch @@ -0,0 +1,155 @@ +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} +diff --git a/test/asan/CMakeLists.txt b/test/asan/CMakeLists.txt +index 8bfc15b5c..f23d0f71a 100644 +--- a/test/asan/CMakeLists.txt ++++ b/test/asan/CMakeLists.txt +@@ -83,58 +83,6 @@ foreach(arch ${ASAN_TEST_ARCH}) + endif() + endforeach() + +-# iOS and iOS simulator test suites +-# These are not added into "check-all", in order to run these tests, use +-# "check-asan-iossim-x86_64" and similar. They also require that an extra env +-# variable to select which iOS device or simulator to use, e.g.: +-# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6" +-if(APPLE) +- set(EXCLUDE_FROM_ALL ON) +- +- set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER}) +- set(ASAN_TEST_IOS "1") +- pythonize_bool(ASAN_TEST_IOS) +- set(ASAN_TEST_DYNAMIC True) +- +- foreach(arch ${DARWIN_iossim_ARCHS}) +- set(ASAN_TEST_IOSSIM "1") +- pythonize_bool(ASAN_TEST_IOSSIM) +- set(ASAN_TEST_TARGET_ARCH ${arch}) +- set(ASAN_TEST_TARGET_CFLAGS "-arch ${arch} -isysroot ${DARWIN_iossim_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") +- set(ASAN_TEST_CONFIG_SUFFIX "-${arch}-iossim") +- get_bits_for_arch(${arch} ASAN_TEST_BITS) +- string(TOUPPER ${arch} ARCH_UPPER_CASE) +- set(CONFIG_NAME "IOSSim${ARCH_UPPER_CASE}Config") +- configure_lit_site_cfg( +- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in +- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg +- ) +- add_lit_testsuite(check-asan-iossim-${arch} "AddressSanitizer iOS Simulator ${arch} tests" +- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ +- DEPENDS ${ASAN_TEST_DEPS}) +- endforeach() +- +- foreach (arch ${DARWIN_ios_ARCHS}) +- set(ASAN_TEST_IOSSIM "0") +- pythonize_bool(ASAN_TEST_IOSSIM) +- set(ASAN_TEST_TARGET_ARCH ${arch}) +- set(ASAN_TEST_TARGET_CFLAGS "-arch ${arch} -isysroot ${DARWIN_ios_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") +- set(ASAN_TEST_CONFIG_SUFFIX "-${arch}-ios") +- get_bits_for_arch(${arch} ASAN_TEST_BITS) +- string(TOUPPER ${arch} ARCH_UPPER_CASE) +- set(CONFIG_NAME "IOS${ARCH_UPPER_CASE}Config") +- configure_lit_site_cfg( +- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in +- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg +- ) +- add_lit_testsuite(check-asan-ios-${arch} "AddressSanitizer iOS ${arch} tests" +- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ +- DEPENDS ${ASAN_TEST_DEPS}) +- endforeach() +- +- set(EXCLUDE_FROM_ALL OFF) +-endif() +- + # Add unit tests. + if(COMPILER_RT_INCLUDE_TESTS) + set(ASAN_TEST_DYNAMIC False) +diff --git a/test/tsan/CMakeLists.txt b/test/tsan/CMakeLists.txt +index a68908612..cde0accb5 100644 +--- a/test/tsan/CMakeLists.txt ++++ b/test/tsan/CMakeLists.txt +@@ -42,53 +42,6 @@ foreach(arch ${TSAN_TEST_ARCH}) + list(APPEND TSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}) + endforeach() + +-# iOS and iOS simulator test suites +-# These are not added into "check-all", in order to run these tests, use +-# "check-tsan-iossim-x86_64" and similar. They also require an extra environment +-# variable to select which iOS device or simulator to use, e.g.: +-# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6" +-if(APPLE) +- set(EXCLUDE_FROM_ALL ON) +- +- set(TSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER}) +- set(TSAN_TEST_IOS "1") +- pythonize_bool(TSAN_TEST_IOS) +- +- set(arch "x86_64") +- set(TSAN_TEST_IOSSIM "1") +- pythonize_bool(TSAN_TEST_IOSSIM) +- set(TSAN_TEST_TARGET_ARCH ${arch}) +- set(TSAN_TEST_TARGET_CFLAGS "-arch ${arch} -isysroot ${DARWIN_iossim_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") +- set(TSAN_TEST_CONFIG_SUFFIX "-${arch}-iossim") +- string(TOUPPER ${arch} ARCH_UPPER_CASE) +- set(CONFIG_NAME "IOSSim${ARCH_UPPER_CASE}Config") +- configure_lit_site_cfg( +- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in +- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg +- ) +- add_lit_testsuite(check-tsan-iossim-${arch} "ThreadSanitizer iOS Simulator ${arch} tests" +- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ +- DEPENDS ${TSAN_TEST_DEPS}) +- +- set(arch "arm64") +- set(TSAN_TEST_IOSSIM "0") +- pythonize_bool(TSAN_TEST_IOSSIM) +- set(TSAN_TEST_TARGET_ARCH ${arch}) +- set(TSAN_TEST_TARGET_CFLAGS "-arch ${arch} -isysroot ${DARWIN_ios_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") +- set(TSAN_TEST_CONFIG_SUFFIX "-${arch}-ios") +- string(TOUPPER ${arch} ARCH_UPPER_CASE) +- set(CONFIG_NAME "IOS${ARCH_UPPER_CASE}Config") +- configure_lit_site_cfg( +- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in +- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg +- ) +- add_lit_testsuite(check-tsan-ios-${arch} "ThreadSanitizer iOS Simulator ${arch} tests" +- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ +- DEPENDS ${TSAN_TEST_DEPS}) +- +- set(EXCLUDE_FROM_ALL OFF) +-endif() +- + if(COMPILER_RT_INCLUDE_TESTS) + configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in +-- +2.14.1 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-sys-ustat.patch b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-sys-ustat.patch new file mode 100644 index 000000000000..d9e9a10d8600 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt-sys-ustat.patch @@ -0,0 +1,58 @@ +From 521935db9de17ad08748fd050137ac83b7734835 Mon Sep 17 00:00:00 2001 +From: Craig Topper <craig.topper@intel.com> +Date: Thu, 24 May 2018 17:59:47 +0000 +Subject: [PATCH] sanitizer: Use pre-computed size of struct ustat for Linux + +<sys/ustat.h> has been removed from glibc 2.28 by: + +commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7 +Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> +Date: Sun Mar 18 11:28:59 2018 +0800 + +Deprecate ustat syscall interface +This patch uses pre-computed size of struct ustat for Linux to fix + +https://bugs.llvm.org/show_bug.cgi?id=37418 + +Patch by H.J. Lu. + +Differential Revision: https://reviews.llvm.org/D47281 + +git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@333213 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + .../sanitizer_platform_limits_posix.cc | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +index 94b8f3f627..936d818673 100644 +--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -159,7 +159,6 @@ typedef struct user_fpregs elf_fpregset_t; + # include <sys/procfs.h> + #endif + #include <sys/user.h> +-#include <sys/ustat.h> + #include <linux/cyclades.h> + #include <linux/if_eql.h> + #include <linux/if_plip.h> +@@ -253,7 +252,19 @@ namespace __sanitizer { + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + + #if SANITIZER_LINUX && !SANITIZER_ANDROID +- unsigned struct_ustat_sz = sizeof(struct ustat); ++ // 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) \ ++ || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \ ++ || defined(__x86_64__) ++#define SIZEOF_STRUCT_USTAT 32 ++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \ ++ || defined(__powerpc__) || defined(__s390__) ++#define SIZEOF_STRUCT_USTAT 20 ++#else ++#error Unknown size of struct ustat ++#endif ++ unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT; + unsigned struct_rlimit64_sz = sizeof(struct rlimit64); + unsigned struct_statvfs64_sz = sizeof(struct statvfs64); + #endif // SANITIZER_LINUX && !SANITIZER_ANDROID diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt.nix new file mode 100644 index 000000000000..41f2b24b057e --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt.nix @@ -0,0 +1,88 @@ +{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }: + +let + + useLLVM = stdenv.hostPlatform.useLLVM or false; + bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; + inherit (stdenv.hostPlatform) isMusl; + +in + +stdenv.mkDerivation { + pname = "compiler-rt"; + inherit version; + src = fetch "compiler-rt" "0ipd4jdxpczgr2w6lzrabymz6dhzj69ywmyybjjc1q397zgrvziy"; + + nativeBuildInputs = [ cmake python3 llvm ]; + buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi; + + NIX_CFLAGS_COMPILE = [ + "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" + ]; + + cmakeFlags = [ + "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" + "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" + "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" + ] ++ stdenv.lib.optionals (useLLVM || bareMetal || isMusl) [ + "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" + "-DCOMPILER_RT_BUILD_XRAY=OFF" + "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" + "-DCOMPILER_RT_BUILD_PROFILE=OFF" + ] ++ stdenv.lib.optionals (useLLVM || bareMetal) [ + "-DCMAKE_C_COMPILER_WORKS=ON" + "-DCMAKE_CXX_COMPILER_WORKS=ON" + "-DCOMPILER_RT_BAREMETAL_BUILD=ON" + "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" + ] ++ stdenv.lib.optionals (useLLVM) [ + "-DCOMPILER_RT_BUILD_BUILTINS=ON" + "-DCMAKE_C_FLAGS=-nodefaultlibs" + #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program + "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" + ] ++ stdenv.lib.optionals (bareMetal) [ + "-DCOMPILER_RT_OS_DIR=baremetal" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.isDarwin) [ + # The compiler-rt build infrastructure sniffs supported platforms on Darwin + # and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails + # when it tries to use libc++ and libc++api for i386. + "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}" + ]; + + outputs = [ "out" "dev" ]; + + patches = [ + ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory + ../7/compiler-rt-glibc.patch + ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch + ++ stdenv.lib.optional (stdenv.hostPlatform.libc == "glibc") ./compiler-rt-sys-ustat.patch + ++ stdenv.lib.optional stdenv.hostPlatform.isAarch32 ./compiler-rt-armv7l.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)' + '' + stdenv.lib.optionalString (useLLVM) '' + substituteInPlace lib/builtins/int_util.c \ + --replace "#include <stdlib.h>" "" + substituteInPlace lib/builtins/clear_cache.c \ + --replace "#include <assert.h>" "" + substituteInPlace lib/builtins/cpu_model.c \ + --replace "#include <assert.h>" "" + ''; + + # Hack around weird upsream RPATH bug + postInstall = stdenv.lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) '' + ln -s "$out/lib"/*/* "$out/lib" + '' + stdenv.lib.optionalString (useLLVM) '' + ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/linux/crtbegin.o + ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o + ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o + ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o + ''; + + enableParallelBuilding = true; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/default.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/default.nix new file mode 100644 index 000000000000..36495249d16f --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/default.nix @@ -0,0 +1,95 @@ +{ lowPrio, newScope, pkgs, stdenv, cmake, gccForLibs +, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith +, buildPackages +, buildLlvmTools # tools, but from the previous stage, for cross +, targetLlvmLibraries # libraries, but from the next stage, for cross +}: + +let + release_version = "5.0.2"; + version = release_version; # differentiating these is important for rc's + targetConfig = stdenv.targetPlatform.config; + + 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" "018b3fiwah8f8br5i26qmzh6sjvzchpn358sn8v079m49f2jldm3"; + + tools = stdenv.lib.makeExtensible (tools: let + callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 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 && !(stdenv.targetPlatform.useLLVM or false)) '' + echo "--gcc-toolchain=${gccForLibs}" >> $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; + python3 = pkgs.python3; # don't use python-boot + }); + + clang-manpages = lowPrio (tools.clang-unwrapped.override { + enableManpages = true; + python3 = pkgs.python3; # 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; + # libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper. + libcxx = null; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + + libcxxClang = wrapCCWith rec { + cc = tools.clang-unwrapped; + libcxx = targetLlvmLibraries.libcxx; + extraPackages = [ + 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 python3 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 diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/fix-gcc9.patch b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/fix-gcc9.patch new file mode 100644 index 000000000000..eaf71f1468de --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/fix-gcc9.patch @@ -0,0 +1,33 @@ +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 +@@ -70,6 +70,7 @@ + #include <cassert> + #include <cstdint> + #include <new> ++#include <array> + + #define DEBUG_TYPE "mips-fastisel" + +@@ -1309,13 +1310,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/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/libc++/default.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/libc++/default.nix new file mode 100644 index 000000000000..9bebedbc0442 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/libc++/default.nix @@ -0,0 +1,52 @@ +{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version }: + +stdenv.mkDerivation { + pname = "libc++"; + inherit version; + + src = fetch "libcxx" "1672aaf95fgy4xsfra8pw24f6r93zwzpan1033hkcm8p2glqipvf"; + + postUnpack = '' + unpackFile ${libcxxabi.src} + export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" + ''; + + patches = stdenv.lib.optionals 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 python3 + ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; + + buildInputs = [ libcxxabi ]; + + 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; + + passthru = { + isLLVM = true; + }; + + meta = { + homepage = "https://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/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/libc++abi.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/libc++abi.nix new file mode 100644 index 000000000000..96d6e78e01e4 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/libc++abi.nix @@ -0,0 +1,51 @@ +{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }: + +stdenv.mkDerivation { + pname = "libc++abi"; + inherit version; + + src = fetch "libcxxabi" "12lp799rskr4fc2xr64qn4jfkjnfd8b1aymvsxyn4k9ar7r9pgqv"; + + 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 + # https://gitlab.kitware.com/cmake/community/-/wikis/doc/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 = "https://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/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/lld.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/lld.nix new file mode 100644 index 000000000000..3d9ed6ee6635 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/lld.nix @@ -0,0 +1,33 @@ +{ stdenv +, fetch +, cmake +, llvm +, version +}: + +stdenv.mkDerivation { + pname = "lld"; + inherit version; + + src = fetch "lld" "1ah75rjly6747jk1zbwca3z0svr9b09ylgxd4x9ns721xir6sia6"; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ llvm ]; + + outputs = [ "out" "dev" ]; + + enableParallelBuilding = true; + + postInstall = '' + moveToOutput include "$dev" + moveToOutput lib "$dev" + ''; + + meta = { + description = "The LLVM Linker"; + homepage = "https://lld.llvm.org/"; + license = stdenv.lib.licenses.ncsa; + platforms = stdenv.lib.platforms.all; + badPlatforms = [ "x86_64-darwin" ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/lldb.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/lldb.nix new file mode 100644 index 000000000000..e827f76231f1 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/lldb.nix @@ -0,0 +1,67 @@ +{ stdenv +, fetch +, fetchpatch +, cmake +, zlib +, ncurses +, swig +, which +, libedit +, libxml2 +, llvm +, clang-unwrapped +, python3 +, version +, darwin +}: + +stdenv.mkDerivation { + pname = "lldb"; + inherit version; + + src = fetch "lldb" "05j2a63yzln43852nng8a7y47spzlyr1cvdmgmbxgd29c8r0bfkq"; + + patches = [ + # Fix PythonString::GetString for >=python-3.7 + (fetchpatch { + url = "https://github.com/llvm/llvm-project/commit/5457b426f5e15a29c0acc8af1a476132f8be2a36.patch"; + sha256 = "1zbx4m0m8kbg0wq6740jcw151vb2pb1p25p401wiq8diqqagkjps"; + stripLen = 1; + }) + ]; + + 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 python3 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 = "https://llvm.org/"; + license = licenses.ncsa; + platforms = platforms.all; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/llvm-outputs.patch b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/llvm-outputs.patch new file mode 100644 index 000000000000..40096fa3497f --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/llvm-outputs.patch @@ -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, diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/llvm.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/llvm.nix new file mode 100644 index 000000000000..987e6258527a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/llvm.nix @@ -0,0 +1,177 @@ +{ stdenv +, fetch +, fetchpatch +, cmake +, python3 +, libffi +, libbfd +, libxml2 +, ncurses +, version +, release_version +, zlib +, 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" "0g1bbj2n6xv4p1n6hh17vj3vpvg56wacipc81dgwga9mg2lys8nm"; + + unpackPhase = '' + unpackFile $src + mv llvm-${version}* llvm + sourceRoot=$PWD/llvm + ''; + + outputs = [ "out" "python" ] + ++ stdenv.lib.optional enableSharedLibraries "lib"; + + nativeBuildInputs = [ cmake python3 ] + ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx; + + buildInputs = [ libxml2 libffi ]; + + propagatedBuildInputs = [ ncurses zlib ]; + + patches = [ + (fetchpatch { + url = "https://bugzilla.redhat.com/attachment.cgi?id=1389687"; + name = "llvm-gcc8-type-mismatch.patch"; + sha256 = "0ga2123aclq3x9w72d0rm0az12m8c1i4r1106vh701hf4cghgbch"; + }) + ./fix-gcc9.patch + #(fetchpatch { + # name = "llvm-fix-gcc9.patch"; + # url = "https://reviews.llvm.org/file/data/zs3ck5ryvc5n672fd2kw/PHID-FILE-byoqefzwmkd7qnlip4v2/file"; + # sha256 = "0injj1hqgrbcbihhwp2nbal88jfykad30r54f2cdcx7gws2fcy8i"; + # stripLen = 1; + #}) + ]; + postPatch = stdenv.lib.optionalString stdenv.isDarwin '' + 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 + '' + '' + # 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.isAarch64 '' + patch -p0 < ${../aarch64.patch} + '' + 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 + ''; + + # 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}" + ] + ++ 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''${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" + moveToOutput "lib/libLTO${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" \ + --replace "\''${_IMPORT_PREFIX}/lib/libLTO.dylib" "$lib/lib/libLTO.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; + + requiredSystemFeatures = [ "big-parallel" ]; + meta = { + description = "Collection of modular and reusable compiler and toolchain technologies"; + homepage = "https://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/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/openmp.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/openmp.nix new file mode 100644 index 000000000000..da328de24d13 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/openmp.nix @@ -0,0 +1,26 @@ +{ stdenv +, fetch +, cmake +, llvm +, perl +, version +}: + +stdenv.mkDerivation { + pname = "openmp"; + inherit version; + + src = fetch "openmp" "0p2n52676wlq6y9q99n5pivq6pvvda1p994r69fxj206ahn59jir"; + + nativeBuildInputs = [ cmake perl ]; + buildInputs = [ llvm ]; + + enableParallelBuilding = true; + + meta = { + description = "Components required to build an executable OpenMP program"; + homepage = "https://openmp.llvm.org/"; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/sanitizers-nongnu.patch b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/sanitizers-nongnu.patch new file mode 100644 index 000000000000..c9ddfe45c898 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/llvm/5/sanitizers-nongnu.patch @@ -0,0 +1,370 @@ +From 3e1fcb7d4909db8f0f7dd0109b2eee20115c8be3 Mon Sep 17 00:00:00 2001 +From: "Jory A. Pratt" <anarchy@gentoo.org> +Date: Sat, 9 Sep 2017 08:31:15 -0500 +Subject: [PATCH] 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 | 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 | 40 +++++++++++++--------- + lib/tsan/rtl/tsan_platform_linux.cc | 2 +- + 11 files changed, 47 insertions(+), 32 deletions(-) + +diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc +index 6d47ba432..c58dd4864 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 +@@ -86,7 +86,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..76c1688ce 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__) && defined(__GLIBC__) // 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..f60c38991 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 52196db12..045d9331f 100644 +--- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc ++++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc +@@ -148,7 +148,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__ +@@ -176,11 +176,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__) \ +- || defined(__arm__)) && SANITIZER_LINUX && !SANITIZER_ANDROID ++ || defined(__arm__)) && SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + // sizeof(struct pthread) from glibc. + static atomic_uintptr_t kThreadDescriptorSize; + +@@ -335,7 +335,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(); +@@ -362,7 +362,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 +@@ -373,7 +373,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 396f7c934..5af6f1ed5 100644 +--- a/lib/sanitizer_common/sanitizer_platform.h ++++ b/lib/sanitizer_common/sanitizer_platform.h +@@ -175,6 +175,13 @@ + # define SANITIZER_ARM 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 0380cee92..0a39abbd0 100644 +--- a/lib/sanitizer_common/sanitizer_platform_interceptors.h ++++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h +@@ -31,7 +31,7 @@ + # define SI_POSIX 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 83f4fd22f..fa8c1b8bd 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 +@@ -159,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> +@@ -251,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); +@@ -309,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 +@@ -403,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); +@@ -453,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) +@@ -821,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; +@@ -976,7 +982,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); +@@ -1010,6 +1016,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); +@@ -1023,6 +1030,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); +@@ -1125,7 +1133,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); +@@ -1186,7 +1194,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 + +@@ -1236,7 +1244,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); +@@ -1255,7 +1263,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 ead1e5704..2c020e3fe 100644 +--- a/lib/tsan/rtl/tsan_platform_linux.cc ++++ b/lib/tsan/rtl/tsan_platform_linux.cc +@@ -284,7 +284,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.16.2 + |