From bb110d80fc7bbc06fd71bfa1122c016f14f43394 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 18 Sep 2018 14:19:58 -0500 Subject: [PATCH 01/12] llvm7: init at 7.0.0rc3 Copy of 6 + updated hashes --- .../compilers/llvm/7/clang/default.nix | 106 +++++ .../compilers/llvm/7/clang/purity.patch | 30 ++ .../llvm/7/compiler-rt-codesign.patch | 155 +++++++ .../compilers/llvm/7/compiler-rt.nix | 37 ++ pkgs/development/compilers/llvm/7/default.nix | 93 ++++ .../compilers/llvm/7/libc++/default.nix | 54 +++ .../compilers/llvm/7/libc++/setup-hook.sh | 6 + .../compilers/llvm/7/libc++abi.nix | 49 +++ pkgs/development/compilers/llvm/7/lld.nix | 32 ++ pkgs/development/compilers/llvm/7/lldb.nix | 56 +++ .../compilers/llvm/7/llvm-outputs.patch | 26 ++ pkgs/development/compilers/llvm/7/llvm.nix | 166 +++++++ pkgs/development/compilers/llvm/7/openmp.nix | 25 ++ .../compilers/llvm/7/sanitizers-nongnu.patch | 413 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 12 + 15 files changed, 1260 insertions(+) create mode 100644 pkgs/development/compilers/llvm/7/clang/default.nix create mode 100644 pkgs/development/compilers/llvm/7/clang/purity.patch create mode 100644 pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch create mode 100644 pkgs/development/compilers/llvm/7/compiler-rt.nix create mode 100644 pkgs/development/compilers/llvm/7/default.nix create mode 100644 pkgs/development/compilers/llvm/7/libc++/default.nix create mode 100644 pkgs/development/compilers/llvm/7/libc++/setup-hook.sh create mode 100644 pkgs/development/compilers/llvm/7/libc++abi.nix create mode 100644 pkgs/development/compilers/llvm/7/lld.nix create mode 100644 pkgs/development/compilers/llvm/7/lldb.nix create mode 100644 pkgs/development/compilers/llvm/7/llvm-outputs.patch create mode 100644 pkgs/development/compilers/llvm/7/llvm.nix create mode 100644 pkgs/development/compilers/llvm/7/openmp.nix create mode 100644 pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch diff --git a/pkgs/development/compilers/llvm/7/clang/default.nix b/pkgs/development/compilers/llvm/7/clang/default.nix new file mode 100644 index 000000000000..2dbf5bd8a8e1 --- /dev/null +++ b/pkgs/development/compilers/llvm/7/clang/default.nix @@ -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" "18aapi26lp25g38j1kwmzviagy9l59ach5kzvf80x5dvs2rmhcpc"} + 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 diff --git a/pkgs/development/compilers/llvm/7/clang/purity.patch b/pkgs/development/compilers/llvm/7/clang/purity.patch new file mode 100644 index 000000000000..b30d0d0b5d5b --- /dev/null +++ b/pkgs/development/compilers/llvm/7/clang/purity.patch @@ -0,0 +1,30 @@ +From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001 +From: Will Dietz +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/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch b/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch new file mode 100644 index 000000000000..8f4c76bca1eb --- /dev/null +++ b/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch @@ -0,0 +1,155 @@ +From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001 +From: Will Dietz +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 - $ +- 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/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix new file mode 100644 index 000000000000..fe83d8675854 --- /dev/null +++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix @@ -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" "0r4hg8hi60kdjl4arp3s51dbwbwz11s8qvccdkx9v52vc27p2241"; + + 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; +} diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix new file mode 100644 index 000000000000..2526f1ab17e7 --- /dev/null +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -0,0 +1,93 @@ +{ 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 + "rc3"; # differentiating these is important for rc's + + fetch = name: sha256: fetchurl { + name = "${name}-${release_version}.src.tar.xz"; + url = "http://prereleases.llvm.org/${release_version}/rc3/${name}-${version}.src.tar.xz"; + inherit sha256; + }; + + clang-tools-extra_src = fetch "clang-tools-extra" "0rhvlz4g2nd10zrwx37yi5if8wqirh8845pwbgg62r9l2pb6j7n7"; + + 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 diff --git a/pkgs/development/compilers/llvm/7/libc++/default.nix b/pkgs/development/compilers/llvm/7/libc++/default.nix new file mode 100644 index 000000000000..01ee8b4c60c2 --- /dev/null +++ b/pkgs/development/compilers/llvm/7/libc++/default.nix @@ -0,0 +1,54 @@ +{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version }: + +stdenv.mkDerivation rec { + name = "libc++-${version}"; + + src = fetch "libcxx" "1ylw8sdiy7b9siajm88frw95y8ii1kng3xbsqhn8nmhy0yxwd1p5"; + + postUnpack = '' + unpackFile ${libcxxabi.src} + export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" + ''; + + # on next rebuild, this can be replaced with optionals; for now set to null to avoid + # patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + patches = if stdenv.hostPlatform.isMusl then [ + ../../libcxx-0001-musl-hacks.patch + ] else null; + + prePatch = '' + substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++" + ''; + + preConfigure = '' + # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package + cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR") + '' + lib.optionalString stdenv.hostPlatform.isMusl '' + patchShebangs utils/cat_files.py + ''; + nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python; + + buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; + + cmakeFlags = [ + "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" + "-DLIBCXX_LIBCPPABI_VERSION=2" + "-DLIBCXX_CXX_ABI=libcxxabi" + ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1"; + + enableParallelBuilding = true; + + linkCxxAbi = stdenv.isLinux; + + setupHooks = [ + ../../../../../build-support/setup-hooks/role.bash + ./setup-hook.sh + ]; + + meta = { + homepage = http://libcxx.llvm.org/; + description = "A new implementation of the C++ standard library, targeting C++11"; + license = with stdenv.lib.licenses; [ ncsa mit ]; + platforms = stdenv.lib.platforms.unix; + }; +} diff --git a/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh new file mode 100644 index 000000000000..6611259165ae --- /dev/null +++ b/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh @@ -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"}" diff --git a/pkgs/development/compilers/llvm/7/libc++abi.nix b/pkgs/development/compilers/llvm/7/libc++abi.nix new file mode 100644 index 000000000000..eb7237598bd5 --- /dev/null +++ b/pkgs/development/compilers/llvm/7/libc++abi.nix @@ -0,0 +1,49 @@ +{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }: + +stdenv.mkDerivation { + name = "libc++abi-${version}"; + + src = fetch "libcxxabi" "1ry0v4sd91gg06kqkhqcnbwbd5v1yknbpm0gj39lq8y3d7lwn7np"; + + 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; + }; +} diff --git a/pkgs/development/compilers/llvm/7/lld.nix b/pkgs/development/compilers/llvm/7/lld.nix new file mode 100644 index 000000000000..db778d2d2a72 --- /dev/null +++ b/pkgs/development/compilers/llvm/7/lld.nix @@ -0,0 +1,32 @@ +{ stdenv +, fetch +, cmake +, libxml2 +, llvm +, version +}: + +stdenv.mkDerivation { + name = "lld-${version}"; + + src = fetch "lld" "10p8yqikpsx1hvs524dj6fk7hg267bhs6860xngk33130s9s05id"; + + 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; + }; +} diff --git a/pkgs/development/compilers/llvm/7/lldb.nix b/pkgs/development/compilers/llvm/7/lldb.nix new file mode 100644 index 000000000000..b8206ca3feff --- /dev/null +++ b/pkgs/development/compilers/llvm/7/lldb.nix @@ -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" "1s2jiaq85nzbab3nj4msfw3zxkdwinq71p1d7h70z26q3caddngp"; + + 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; + }; +} diff --git a/pkgs/development/compilers/llvm/7/llvm-outputs.patch b/pkgs/development/compilers/llvm/7/llvm-outputs.patch new file mode 100644 index 000000000000..40096fa3497f --- /dev/null +++ b/pkgs/development/compilers/llvm/7/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/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix new file mode 100644 index 000000000000..327647a7e72a --- /dev/null +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -0,0 +1,166 @@ +{ stdenv +, fetch +, cmake +, python +, libffi +, libbfd +, libxml2 +, ncurses +, version +, release_version +, zlib +, debugVersion ? false +, enableManpages ? false +, enableSharedLibraries ? true +, enableWasm ? true +}: + +let + src = fetch "llvm" "0r28srr8i0qcx8csblzg1g59wv4q8qc9c9msdm2xfsfggj2sknqa"; + + # Used when creating a version-suffixed symlink of libLLVM.dylib + shortVersion = with stdenv.lib; + concatStringsSep "." (take 2 (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 ]; + + 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 + ''; + + # 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 + ''; + + outputs = [ "out" ]; + + doCheck = false; + + meta.description = "man pages for LLVM ${version}"; +}) diff --git a/pkgs/development/compilers/llvm/7/openmp.nix b/pkgs/development/compilers/llvm/7/openmp.nix new file mode 100644 index 000000000000..a1d4a72e2687 --- /dev/null +++ b/pkgs/development/compilers/llvm/7/openmp.nix @@ -0,0 +1,25 @@ +{ stdenv +, fetch +, cmake +, llvm +, perl +, version +}: + +stdenv.mkDerivation { + name = "openmp-${version}"; + + src = fetch "openmp" "198iljq5hhm5rxfzslzbi73sq80jlwfr24a3khdk32lghdj2skdw"; + + nativeBuildInputs = [ cmake perl ]; + buildInputs = [ llvm ]; + + enableParallelBuilding = true; + + meta = { + description = "Components required to build an executable OpenMP program"; + homepage = http://openmp.llvm.org/; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch b/pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch new file mode 100644 index 000000000000..6266eb1958d1 --- /dev/null +++ b/pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch @@ -0,0 +1,413 @@ +From 7b4b3333a2718628b1d510ec1d8438ad67308299 Mon Sep 17 00:00:00 2001 +From: Will Dietz +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 + +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 + #endif + +-#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS ++#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS || SANITIZER_NONGNU + #include + 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 +-#include ++# if !SANITIZER_NONGNU ++# include ++# endif + #include +-#include +-#include +-#include +-#include ++#include ++#include ++#include ++#include + #if HAVE_RPC_XDR_H + # include + #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 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 + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3ecd69cc0aa7..dacfc95d82ca 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6381,6 +6381,7 @@ with pkgs; }; }; + clang_7 = llvmPackages_7.clang; clang_6 = llvmPackages_6.clang; clang_5 = llvmPackages_5.clang; clang_4 = llvmPackages_4.clang; @@ -6978,15 +6979,18 @@ with pkgs; lld_4 = llvmPackages_4.lld; lld_5 = llvmPackages_5.lld; lld_6 = llvmPackages_6.lld; + lld_7 = llvmPackages_7.lld; lldb = llvmPackages.lldb; lldb_4 = llvmPackages_4.lldb; lldb_5 = llvmPackages_5.lldb; lldb_6 = llvmPackages_6.lldb; + lldb_7 = llvmPackages_7.lldb; llvm = llvmPackages.llvm; llvm-manpages = llvmPackages.llvm-manpages; + llvm_7 = llvmPackages_7.llvm; llvm_6 = llvmPackages_6.llvm; llvm_5 = llvmPackages_5.llvm; llvm_4 = llvmPackages_4.llvm; @@ -7051,6 +7055,14 @@ with pkgs; 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 { }; mentorToolchains = recurseIntoAttrs ( From b7692f5be5ac9d08dbf6575b8e8678037678ca14 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 18 Sep 2018 14:35:21 -0500 Subject: [PATCH 02/12] llvm7: patch test shebang (otherwise test fails) --- pkgs/development/compilers/llvm/7/llvm.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix index 327647a7e72a..ea0a520dbd67 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -59,6 +59,8 @@ in stdenv.mkDerivation (rec { 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 From 38699890d6622debd4a18ab1d557cb162f0edbf7 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 18 Sep 2018 14:45:39 -0500 Subject: [PATCH 03/12] llvm-manpages: fix build by removing references to $lib output --- pkgs/development/compilers/llvm/7/llvm.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix index ea0a520dbd67..053d0372507d 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -160,6 +160,9 @@ in stdenv.mkDerivation (rec { make -C docs install ''; + postPatch = null; + postInstall = null; + outputs = [ "out" ]; doCheck = false; From ba701ef3297b5af3673df2d4d6a1b187a1e08930 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 18 Sep 2018 14:52:17 -0500 Subject: [PATCH 04/12] comment --- pkgs/development/compilers/llvm/7/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index 2526f1ab17e7..ba0ad884bbd0 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -9,7 +9,7 @@ let version = release_version + "rc3"; # differentiating these is important for rc's fetch = name: sha256: fetchurl { - name = "${name}-${release_version}.src.tar.xz"; + name = "${name}-${release_version}.src.tar.xz"; # Hopefully yields same hash with final release url = "http://prereleases.llvm.org/${release_version}/rc3/${name}-${version}.src.tar.xz"; inherit sha256; }; From 621fd23cb5961ffe2c6b7f2f23ae0f35187c50c5 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 18 Sep 2018 15:00:39 -0500 Subject: [PATCH 05/12] compiler-rt: quickfix codesign patch by dropping hunks 'already applied' Quite possibly this is not right. --- .../llvm/7/compiler-rt-codesign.patch | 122 ------------------ 1 file changed, 122 deletions(-) diff --git a/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch b/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch index 8f4c76bca1eb..3cc12b94b200 100644 --- a/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch +++ b/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch @@ -29,127 +29,5 @@ index bc5fb9ff7..b64eb4246 100644 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 From 0c459474f97575e9ecb0523903e4838244b424f5 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 18 Sep 2018 15:33:32 -0500 Subject: [PATCH 06/12] tests: add variants for llvm7 --- pkgs/test/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 774077949b25..24255f3f6555 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -17,6 +17,8 @@ with pkgs; cc-wrapper-libcxx-5 = callPackage ./cc-wrapper { stdenv = llvmPackages_5.libcxxStdenv; }; cc-wrapper-clang-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.stdenv; }; 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 { }; cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; }; From fca31e1a68486089e325175f9177a3d00b3e3974 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Wed, 19 Sep 2018 07:43:33 -0500 Subject: [PATCH 07/12] llvm7: use final release tarballs now that they're available --- pkgs/development/compilers/llvm/7/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index ba0ad884bbd0..7f98ab701425 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -6,11 +6,11 @@ let release_version = "7.0.0"; - version = release_version + "rc3"; # differentiating these is important for rc's + version = release_version; # differentiating these is important for rc's fetch = name: sha256: fetchurl { name = "${name}-${release_version}.src.tar.xz"; # Hopefully yields same hash with final release - url = "http://prereleases.llvm.org/${release_version}/rc3/${name}-${version}.src.tar.xz"; + url = "http://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz"; inherit sha256; }; From 0920652c5c97e1646388d501af2a9a1c16ce9a65 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Wed, 19 Sep 2018 08:00:23 -0500 Subject: [PATCH 08/12] llvm7: update hashes, they did change after all. Pretty sure they did last time too :). --- pkgs/development/compilers/llvm/7/clang/default.nix | 2 +- pkgs/development/compilers/llvm/7/compiler-rt.nix | 2 +- pkgs/development/compilers/llvm/7/default.nix | 3 +-- pkgs/development/compilers/llvm/7/libc++/default.nix | 2 +- pkgs/development/compilers/llvm/7/libc++abi.nix | 2 +- pkgs/development/compilers/llvm/7/lld.nix | 2 +- pkgs/development/compilers/llvm/7/lldb.nix | 2 +- pkgs/development/compilers/llvm/7/llvm.nix | 2 +- pkgs/development/compilers/llvm/7/openmp.nix | 2 +- 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pkgs/development/compilers/llvm/7/clang/default.nix b/pkgs/development/compilers/llvm/7/clang/default.nix index 2dbf5bd8a8e1..e1f4eb303603 100644 --- a/pkgs/development/compilers/llvm/7/clang/default.nix +++ b/pkgs/development/compilers/llvm/7/clang/default.nix @@ -9,7 +9,7 @@ let name = "clang-${version}"; unpackPhase = '' - unpackFile ${fetch "cfe" "18aapi26lp25g38j1kwmzviagy9l59ach5kzvf80x5dvs2rmhcpc"} + unpackFile ${fetch "cfe" "0mdsbgj3p7mayhzm8hclzl3i46r2lwa8fr1cz399f9km3iqi40jm"} mv cfe-${version}* clang sourceRoot=$PWD/clang unpackFile ${clang-tools-extra_src} diff --git a/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix index fe83d8675854..ec739d22dd7a 100644 --- a/pkgs/development/compilers/llvm/7/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix @@ -3,7 +3,7 @@ with stdenv.lib; stdenv.mkDerivation rec { name = "compiler-rt-${version}"; inherit version; - src = fetch "compiler-rt" "0r4hg8hi60kdjl4arp3s51dbwbwz11s8qvccdkx9v52vc27p2241"; + src = fetch "compiler-rt" "1mkhqvs8cxbfmprkzwyq7lmnzr1sv45znzf0arbgb19crzipzv5x"; nativeBuildInputs = [ cmake python llvm ]; buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi; diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index 7f98ab701425..9328d830edf4 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -9,12 +9,11 @@ let version = release_version; # differentiating these is important for rc's fetch = name: sha256: fetchurl { - name = "${name}-${release_version}.src.tar.xz"; # Hopefully yields same hash with final release url = "http://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz"; inherit sha256; }; - clang-tools-extra_src = fetch "clang-tools-extra" "0rhvlz4g2nd10zrwx37yi5if8wqirh8845pwbgg62r9l2pb6j7n7"; + 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; }); diff --git a/pkgs/development/compilers/llvm/7/libc++/default.nix b/pkgs/development/compilers/llvm/7/libc++/default.nix index 01ee8b4c60c2..992794f38e54 100644 --- a/pkgs/development/compilers/llvm/7/libc++/default.nix +++ b/pkgs/development/compilers/llvm/7/libc++/default.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation rec { name = "libc++-${version}"; - src = fetch "libcxx" "1ylw8sdiy7b9siajm88frw95y8ii1kng3xbsqhn8nmhy0yxwd1p5"; + src = fetch "libcxx" "1w1l472p03csgz76p70pn9yk7h0nw5hj1av44ysnakigp8jjcd4v"; postUnpack = '' unpackFile ${libcxxabi.src} diff --git a/pkgs/development/compilers/llvm/7/libc++abi.nix b/pkgs/development/compilers/llvm/7/libc++abi.nix index eb7237598bd5..7dbda6c365e0 100644 --- a/pkgs/development/compilers/llvm/7/libc++abi.nix +++ b/pkgs/development/compilers/llvm/7/libc++abi.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation { name = "libc++abi-${version}"; - src = fetch "libcxxabi" "1ry0v4sd91gg06kqkhqcnbwbd5v1yknbpm0gj39lq8y3d7lwn7np"; + src = fetch "libcxxabi" "0pr4xfx61r5mwmvhg4j9pb6df6vvha1gyf6rwkm14x9rzxcwficv"; nativeBuildInputs = [ cmake ]; buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind; diff --git a/pkgs/development/compilers/llvm/7/lld.nix b/pkgs/development/compilers/llvm/7/lld.nix index db778d2d2a72..f6ce768d6484 100644 --- a/pkgs/development/compilers/llvm/7/lld.nix +++ b/pkgs/development/compilers/llvm/7/lld.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation { name = "lld-${version}"; - src = fetch "lld" "10p8yqikpsx1hvs524dj6fk7hg267bhs6860xngk33130s9s05id"; + src = fetch "lld" "173z50vx5mlsaiqmbz7asxy2297z4xivrfxrdfncvx23wp2lgkzv"; nativeBuildInputs = [ cmake ]; buildInputs = [ llvm libxml2 ]; diff --git a/pkgs/development/compilers/llvm/7/lldb.nix b/pkgs/development/compilers/llvm/7/lldb.nix index b8206ca3feff..6c3f0699978f 100644 --- a/pkgs/development/compilers/llvm/7/lldb.nix +++ b/pkgs/development/compilers/llvm/7/lldb.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { name = "lldb-${version}"; - src = fetch "lldb" "1s2jiaq85nzbab3nj4msfw3zxkdwinq71p1d7h70z26q3caddngp"; + src = fetch "lldb" "0cmah36ybyfws0z2ikq9fqn5k4kvjci7vgk97ddx4xwrwkzdixkz"; postPatch = '' # Fix up various paths that assume llvm and clang are installed in the same place diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix index 053d0372507d..ef39dd9e918a 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -16,7 +16,7 @@ }: let - src = fetch "llvm" "0r28srr8i0qcx8csblzg1g59wv4q8qc9c9msdm2xfsfggj2sknqa"; + src = fetch "llvm" "08p27wv1pr9ql2zc3f3qkkymci46q7myvh8r5ijippnbwr2gihcb"; # Used when creating a version-suffixed symlink of libLLVM.dylib shortVersion = with stdenv.lib; diff --git a/pkgs/development/compilers/llvm/7/openmp.nix b/pkgs/development/compilers/llvm/7/openmp.nix index a1d4a72e2687..31059b7c4c04 100644 --- a/pkgs/development/compilers/llvm/7/openmp.nix +++ b/pkgs/development/compilers/llvm/7/openmp.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation { name = "openmp-${version}"; - src = fetch "openmp" "198iljq5hhm5rxfzslzbi73sq80jlwfr24a3khdk32lghdj2skdw"; + src = fetch "openmp" "1zrqlaxr954sp8lcr7g8m0z0pr8xyq4i6p11x6gcamjm5xijnrih"; nativeBuildInputs = [ cmake perl ]; buildInputs = [ llvm ]; From 167e799d81de43b51bf05d8b8e0a7ddac8e06202 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Wed, 19 Sep 2018 08:02:21 -0500 Subject: [PATCH 09/12] llvm*: http -> https, prefer releases.llvm.org --- pkgs/development/compilers/llvm/3.5/default.nix | 2 +- pkgs/development/compilers/llvm/3.7/default.nix | 2 +- pkgs/development/compilers/llvm/3.8/default.nix | 2 +- pkgs/development/compilers/llvm/3.9/default.nix | 2 +- pkgs/development/compilers/llvm/5/default.nix | 2 +- pkgs/development/compilers/llvm/6/default.nix | 2 +- pkgs/development/compilers/llvm/7/default.nix | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/llvm/3.5/default.nix b/pkgs/development/compilers/llvm/3.5/default.nix index f588eb4407b5..b87fa747f145 100644 --- a/pkgs/development/compilers/llvm/3.5/default.nix +++ b/pkgs/development/compilers/llvm/3.5/default.nix @@ -6,7 +6,7 @@ let fetch = fetch_v version; 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; }; diff --git a/pkgs/development/compilers/llvm/3.7/default.nix b/pkgs/development/compilers/llvm/3.7/default.nix index f176894dedb9..3c557711449f 100644 --- a/pkgs/development/compilers/llvm/3.7/default.nix +++ b/pkgs/development/compilers/llvm/3.7/default.nix @@ -9,7 +9,7 @@ let fetch = fetch_v version; 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; }; diff --git a/pkgs/development/compilers/llvm/3.8/default.nix b/pkgs/development/compilers/llvm/3.8/default.nix index 99869e6e80a7..a848c8b9252b 100644 --- a/pkgs/development/compilers/llvm/3.8/default.nix +++ b/pkgs/development/compilers/llvm/3.8/default.nix @@ -8,7 +8,7 @@ let fetch = fetch_v version; 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; }; diff --git a/pkgs/development/compilers/llvm/3.9/default.nix b/pkgs/development/compilers/llvm/3.9/default.nix index 01c08f4bd209..752790cdd853 100644 --- a/pkgs/development/compilers/llvm/3.9/default.nix +++ b/pkgs/development/compilers/llvm/3.9/default.nix @@ -8,7 +8,7 @@ let fetch = fetch_v version; 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; }; diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix index 38d2b0d461d4..68ee80fa7a62 100644 --- a/pkgs/development/compilers/llvm/5/default.nix +++ b/pkgs/development/compilers/llvm/5/default.nix @@ -9,7 +9,7 @@ let version = release_version; # differentiating these is important for rc's 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; }; diff --git a/pkgs/development/compilers/llvm/6/default.nix b/pkgs/development/compilers/llvm/6/default.nix index 831e4b65344c..5ee551f6b6b1 100644 --- a/pkgs/development/compilers/llvm/6/default.nix +++ b/pkgs/development/compilers/llvm/6/default.nix @@ -9,7 +9,7 @@ let version = release_version; # differentiating these is important for rc's 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; }; diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index 9328d830edf4..5446f1b362a9 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -9,7 +9,7 @@ let version = release_version; # differentiating these is important for rc's 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; }; From e3030a2908ca212dd9e6307695effb8bbcaf23af Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Wed, 19 Sep 2018 08:36:40 -0500 Subject: [PATCH 10/12] libc++7: prefer 'optional' as suggested by comment --- pkgs/development/compilers/llvm/7/libc++/default.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkgs/development/compilers/llvm/7/libc++/default.nix b/pkgs/development/compilers/llvm/7/libc++/default.nix index 992794f38e54..76bfb34975e6 100644 --- a/pkgs/development/compilers/llvm/7/libc++/default.nix +++ b/pkgs/development/compilers/llvm/7/libc++/default.nix @@ -10,11 +10,7 @@ stdenv.mkDerivation rec { export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" ''; - # on next rebuild, this can be replaced with optionals; for now set to null to avoid - # patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ - patches = if stdenv.hostPlatform.isMusl then [ - ../../libcxx-0001-musl-hacks.patch - ] else null; + 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++" From b3645d74d1ec4bd88c521376aca59e9cab0093ef Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Thu, 20 Sep 2018 19:42:44 -0500 Subject: [PATCH 11/12] llvm7: only use 1 number in version suffix, upstream changed See llvm 2a6cf85828509e89e18739e5f4b9a958820d66d4 --- pkgs/development/compilers/llvm/7/llvm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix index ef39dd9e918a..4f540d23c9e4 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -20,7 +20,7 @@ let # Used when creating a version-suffixed symlink of libLLVM.dylib shortVersion = with stdenv.lib; - concatStringsSep "." (take 2 (splitString "." release_version)); + concatStringsSep "." (take 1 (splitString "." release_version)); in stdenv.mkDerivation (rec { name = "llvm-${version}"; From 9fe245d7e05f44d42156d3f557d257e17d3ac4f0 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Thu, 20 Sep 2018 19:53:59 -0500 Subject: [PATCH 12/12] llvm7: optionally use libpfm (exegesis), default off w/darwin --- pkgs/development/compilers/llvm/7/llvm.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix index 4f540d23c9e4..67bde813feed 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -4,6 +4,7 @@ , python , libffi , libbfd +, libpfm , libxml2 , ncurses , version @@ -13,6 +14,7 @@ , enableManpages ? false , enableSharedLibraries ? true , enableWasm ? true +, enablePFM ? !stdenv.isDarwin }: let @@ -36,7 +38,8 @@ in stdenv.mkDerivation (rec { nativeBuildInputs = [ cmake python ] ++ stdenv.lib.optional enableManpages python.pkgs.sphinx; - buildInputs = [ libxml2 libffi ]; + buildInputs = [ libxml2 libffi ] + ++ stdenv.lib.optional enablePFM libpfm; # exegesis propagatedBuildInputs = [ ncurses zlib ];