diff options
Diffstat (limited to 'pkgs/development/compilers/llvm')
19 files changed, 63 insertions, 199 deletions
diff --git a/pkgs/development/compilers/llvm/3.7/libc++/default.nix b/pkgs/development/compilers/llvm/3.7/libc++/default.nix index 462e35a483f4..7b7ac7297ba3 100644 --- a/pkgs/development/compilers/llvm/3.7/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.7/libc++/default.nix @@ -43,5 +43,6 @@ stdenv.mkDerivation rec { description = "A new implementation of the C++ standard library, targeting C++11"; license = with stdenv.lib.licenses; [ ncsa mit ]; platforms = stdenv.lib.platforms.unix; + badPlatforms = [ "x86_64-darwin" ]; }; } diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 6c935fd88de5..174cb17908cc 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -22,10 +22,13 @@ assert (stdenv.hostPlatform != stdenv.buildPlatform) -> !enableSharedLibraries; let src = fetch "llvm" "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z"; - # Used when creating a version-suffixed symlink of libLLVM.dylib - shortVersion = with stdenv.lib; - concatStringsSep "." (take 2 (splitString "." version)); -in stdenv.mkDerivation rec { + # Used when creating a versioned symlinks of libLLVM.dylib + versionSuffixes = with stdenv.lib; + let parts = splitString "." version; in + imap (i: _: concatStringsSep "." (take i parts)) parts; +in + +stdenv.mkDerivation { name = "llvm-${version}"; unpackPhase = '' @@ -153,8 +156,9 @@ in stdenv.mkDerivation rec { + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) '' substituteInPlace "$out/lib/cmake/llvm/LLVMExports-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-${version}.dylib + ${stdenv.lib.concatMapStringsSep "\n" (v: '' + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib + '') versionSuffixes} ''; enableParallelBuilding = true; diff --git a/pkgs/development/compilers/llvm/4/lld.nix b/pkgs/development/compilers/llvm/4/lld.nix index 21b0c1c3601c..cf6de26a9e83 100644 --- a/pkgs/development/compilers/llvm/4/lld.nix +++ b/pkgs/development/compilers/llvm/4/lld.nix @@ -27,5 +27,6 @@ stdenv.mkDerivation { homepage = http://lld.llvm.org/; license = stdenv.lib.licenses.ncsa; platforms = stdenv.lib.platforms.all; + badPlatforms = [ "x86_64-darwin" ]; }; } diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix index 5cd7901fe22c..ecb18a580540 100644 --- a/pkgs/development/compilers/llvm/4/llvm.nix +++ b/pkgs/development/compilers/llvm/4/llvm.nix @@ -19,10 +19,13 @@ let src = fetch "llvm" "0l9bf7kdwhlj0kq1hawpyxhna1062z3h7qcz2y8nfl9dz2qksy6s"; - # Used when creating a version-suffixed symlink of libLLVM.dylib - shortVersion = with stdenv.lib; - concatStringsSep "." (take 2 (splitString "." release_version)); -in stdenv.mkDerivation (rec { + # Used when creating a versioned symlinks of libLLVM.dylib + versionSuffixes = with stdenv.lib; + let parts = splitString "." release_version; in + imap (i: _: concatStringsSep "." (take i parts)) parts; +in + +stdenv.mkDerivation (rec { name = "llvm-${version}"; unpackPhase = '' @@ -136,8 +139,9 @@ in stdenv.mkDerivation (rec { + 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 + ${stdenv.lib.concatMapStringsSep "\n" (v: '' + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib + '') versionSuffixes} ''; doCheck = stdenv.isLinux && (!stdenv.isi686); diff --git a/pkgs/development/compilers/llvm/5/lld.nix b/pkgs/development/compilers/llvm/5/lld.nix index 9a47435cf140..bf23f80ef103 100644 --- a/pkgs/development/compilers/llvm/5/lld.nix +++ b/pkgs/development/compilers/llvm/5/lld.nix @@ -27,5 +27,6 @@ stdenv.mkDerivation { homepage = http://lld.llvm.org/; license = stdenv.lib.licenses.ncsa; platforms = stdenv.lib.platforms.all; + badPlatforms = [ "x86_64-darwin" ]; }; } diff --git a/pkgs/development/compilers/llvm/5/llvm.nix b/pkgs/development/compilers/llvm/5/llvm.nix index 41dc20ec4fe3..d6839f0f2909 100644 --- a/pkgs/development/compilers/llvm/5/llvm.nix +++ b/pkgs/development/compilers/llvm/5/llvm.nix @@ -18,10 +18,13 @@ let src = fetch "llvm" "0g1bbj2n6xv4p1n6hh17vj3vpvg56wacipc81dgwga9mg2lys8nm"; - # Used when creating a version-suffixed symlink of libLLVM.dylib - shortVersion = with stdenv.lib; - concatStringsSep "." (take 2 (splitString "." release_version)); -in stdenv.mkDerivation (rec { + # Used when creating a versioned symlinks of libLLVM.dylib + versionSuffixes = with stdenv.lib; + let parts = splitString "." release_version; in + imap (i: _: concatStringsSep "." (take i parts)) parts; +in + +stdenv.mkDerivation (rec { name = "llvm-${version}"; unpackPhase = '' @@ -119,8 +122,9 @@ in stdenv.mkDerivation (rec { 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" - ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib - ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib + ${stdenv.lib.concatMapStringsSep "\n" (v: '' + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib + '') versionSuffixes} ''; doCheck = stdenv.isLinux && (!stdenv.isi686); diff --git a/pkgs/development/compilers/llvm/6/llvm.nix b/pkgs/development/compilers/llvm/6/llvm.nix index 1d96513a0ece..9237d442b776 100644 --- a/pkgs/development/compilers/llvm/6/llvm.nix +++ b/pkgs/development/compilers/llvm/6/llvm.nix @@ -21,11 +21,13 @@ let src = fetch "llvm" "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"; - # Used when creating a version-suffixed symlink of libLLVM.dylib - shortVersion = with stdenv.lib; - concatStringsSep "." (take 2 (splitString "." release_version)); + # Used when creating a versioned symlinks of libLLVM.dylib + versionSuffixes = with stdenv.lib; + let parts = splitString "." release_version; in + imap (i: _: concatStringsSep "." (take i parts)) parts; +in -in stdenv.mkDerivation (rec { +stdenv.mkDerivation (rec { name = "llvm-${version}"; unpackPhase = '' @@ -133,8 +135,9 @@ in stdenv.mkDerivation (rec { + 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 + ${stdenv.lib.concatMapStringsSep "\n" (v: '' + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib + '') versionSuffixes} ''; doCheck = stdenv.isLinux && (!stdenv.isi686); diff --git a/pkgs/development/compilers/llvm/7/clang/default.nix b/pkgs/development/compilers/llvm/7/clang/default.nix index e4252647ce6d..a4877b3fe6f5 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" "067lwggnbg0w1dfrps790r5l6k8n5zwhlsw7zb6zvmfpwpfn4nx4"} + unpackFile ${fetch "cfe" "0vc4i87qwxnw9lci4ayws9spakg0z6w5w670snj9f8g5m9rc8zg9"} mv cfe-${version}* clang sourceRoot=$PWD/clang unpackFile ${clang-tools-extra_src} diff --git a/pkgs/development/compilers/llvm/7/compiler-rt-clock_gettime.patch b/pkgs/development/compilers/llvm/7/compiler-rt-clock_gettime.patch deleted file mode 100644 index f9323ed95c05..000000000000 --- a/pkgs/development/compilers/llvm/7/compiler-rt-clock_gettime.patch +++ /dev/null @@ -1,74 +0,0 @@ -commit f00c7bccf7955b7dfbb4859fd9019e9eb3349f2d -Author: Tobias Mayer <tobim@fastmail.fm> -Date: Wed Feb 13 12:44:17 2019 +0100 - - Provide clock_gettime for xray on macos < 10.12 - -diff --git a/lib/xray/xray_basic_logging.cc b/lib/xray/xray_basic_logging.cc -index a46c151af..38aea6932 100644 ---- a/lib/xray/xray_basic_logging.cc -+++ b/lib/xray/xray_basic_logging.cc -@@ -36,6 +36,29 @@ - #include "xray_tsc.h" - #include "xray_utils.h" - -+#if __MACH__ -+#include <mach/clock.h> -+#include <mach/mach.h> -+enum clockid_t { -+ CLOCK_MONOTONIC = REALTIME_CLOCK, -+ CLOCK_REALTIME = REALTIME_CLOCK -+}; -+ -+int clock_gettime(clockid_t clock_id, struct timespec *ts) { -+ if (ts != NULL) { -+ clock_serv_t cclock; -+ mach_timespec_t mts; -+ host_get_clock_service(mach_host_self(), clock_id, &cclock); -+ clock_get_time(cclock, &mts); -+ mach_port_deallocate(mach_task_self(), cclock); -+ ts->tv_sec = mts.tv_sec; -+ ts->tv_nsec = mts.tv_nsec; -+ return 0; -+ } -+ return -1; -+} -+#endif -+ - namespace __xray { - - SpinMutex LogMutex; -diff --git a/lib/xray/xray_fdr_logging.cc b/lib/xray/xray_fdr_logging.cc -index 4b308b27f..1d044c8fd 100644 ---- a/lib/xray/xray_fdr_logging.cc -+++ b/lib/xray/xray_fdr_logging.cc -@@ -38,6 +38,29 @@ - #include "xray_tsc.h" - #include "xray_utils.h" - -+#if __MACH__ -+#include <mach/clock.h> -+#include <mach/mach.h> -+enum clockid_t { -+ CLOCK_MONOTONIC = REALTIME_CLOCK, -+ CLOCK_REALTIME = REALTIME_CLOCK -+}; -+ -+int clock_gettime(clockid_t clock_id, struct timespec *ts) { -+ if (ts != NULL) { -+ clock_serv_t cclock; -+ mach_timespec_t mts; -+ host_get_clock_service(mach_host_self(), clock_id, &cclock); -+ clock_get_time(cclock, &mts); -+ mach_port_deallocate(mach_task_self(), cclock); -+ ts->tv_sec = mts.tv_sec; -+ ts->tv_nsec = mts.tv_nsec; -+ return 0; -+ } -+ return -1; -+} -+#endif -+ - namespace __xray { - - atomic_sint32_t LoggingStatus = {XRayLogInitStatus::XRAY_LOG_UNINITIALIZED}; diff --git a/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix index 7a6c91fb832b..989529ff8cc8 100644 --- a/pkgs/development/compilers/llvm/7/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { name = "compiler-rt-${version}"; inherit version; - src = fetch "compiler-rt" "065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq"; + src = fetch "compiler-rt" "1n48p8gjarihkws0i2bay5w9bdwyxyxxbpwyng7ba58jb30dlyq5"; nativeBuildInputs = [ cmake python llvm ]; buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi; @@ -26,9 +26,8 @@ stdenv.mkDerivation rec { patches = [ ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory - ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch - ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./crtbegin-and-end.patch - ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin ./compiler-rt-clock_gettime.patch; + ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./crtbegin-and-end.patch + ++ stdenv.lib.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 diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index 060bef69bc15..7f99cc9ae2cd 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -5,7 +5,7 @@ }: let - release_version = "7.0.1"; + release_version = "7.1.0"; version = release_version; # differentiating these is important for rc's fetch = name: sha256: fetchurl { @@ -13,7 +13,7 @@ let inherit sha256; }; - clang-tools-extra_src = fetch "clang-tools-extra" "1v9vc7id1761qm7mywlknsp810232iwyz8rd4y5km4h7pg9cg4sc"; + clang-tools-extra_src = fetch "clang-tools-extra" "0lb4kdh7j2fhfz8kd6iv5df7m3pikiryk1vvwsf87spc90n09q0w"; 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 d372984dac7c..e2ec4e274f4c 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" "1wdrxg365ig0kngx52pd0n820sncp24blb0zpalc579iidhh4002"; + src = fetch "libcxx" "0kmhcapm2cjwalyiqasj9dmqbw59mcwdl8fgl951wg7ax84b8hj4"; 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 b65b75b36886..2fe6f1c58f66 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" "1n6yx0949l9bprh75dffchahn8wplkm79ffk4f2ap9vw2lx90s41"; + src = fetch "libcxxabi" "1zcqxsdjhawgz1cvpk07y3jl6fg9p3ay4nl69zsirqb2ghgyhhb2"; 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 33085eb3c808..63ad43e62cd7 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" "0ca0qygrk87lhjk6cpv1wbmdfnficqqjsda3k7b013idvnralsc8"; + src = fetch "lld" "0rsqb7zcnij5r5ipfhr129j7skr5n9pyr388kjpqwh091952f3x1"; nativeBuildInputs = [ cmake ]; buildInputs = [ llvm libxml2 ]; diff --git a/pkgs/development/compilers/llvm/7/lldb.nix b/pkgs/development/compilers/llvm/7/lldb.nix index 14cc0514fe6d..a697aac5b8f2 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" "10k9lyk3i72j9hca523r9pz79qp7d8q7jqnjy0i3saj1bgknpd3n"; + src = fetch "lldb" "0klsscg1sczc4nw2l53xggi969k361cng2sjjrfp3bv4g5x14s4v"; 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 34f8a5478d1b..c288fd3e2a5c 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -22,12 +22,13 @@ let inherit (stdenv.lib) optional optionals optionalString; - src = fetch "llvm" "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3"; - polly_src = fetch "polly" "0wgvayfilgb530bq51l7szxfb13l24nnrmyji2f6ncq95a24dw8v"; + src = fetch "llvm" "0r1p5didv4rkgxyvbkyz671xddg6i3dxvbpsi1xxipkla0l9pk0v"; + polly_src = fetch "polly" "16qkns4ab4x0azrvhy4j7cncbyb2rrbdrqj87zphvqxm5pvm8m1h"; - # Used when creating a version-suffixed symlink of libLLVM.dylib - shortVersion = with stdenv.lib; - concatStringsSep "." (take 1 (splitString "." release_version)); + # Used when creating a versioned symlinks of libLLVM.dylib + versionSuffixes = with stdenv.lib; + let parts = splitString "." release_version; in + imap (i: _: concatStringsSep "." (take i parts)) parts; in stdenv.mkDerivation (rec { name = "llvm-${version}"; @@ -53,12 +54,6 @@ in stdenv.mkDerivation (rec { propagatedBuildInputs = [ ncurses zlib ]; patches = [ - # https://bugs.llvm.org/show_bug.cgi?id=39427 - # https://github.com/NixOS/nixpkgs/issues/54370 - (fetchpatch { - url = "https://github.com/llvm-mirror/llvm/commit/57567def148f387153a8149fb590bd39b1b006a1.patch"; - sha256 = "1w1xg5pxpc6cals1nf5j5k4p6qi8lcrpvn0paxc86m415i79xmcg"; - }) # backport, fix building rust crates with lto (fetchpatch { url = "https://github.com/llvm-mirror/llvm/commit/da1fb72bb305d6bc1f3899d541414146934bf80f.patch"; @@ -148,8 +143,9 @@ in stdenv.mkDerivation (rec { + 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 + ${stdenv.lib.concatMapStringsSep "\n" (v: '' + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib + '') versionSuffixes} ''; doCheck = stdenv.isLinux && (!stdenv.isx86_32); diff --git a/pkgs/development/compilers/llvm/7/openmp.nix b/pkgs/development/compilers/llvm/7/openmp.nix index fb856eaa51fd..e55f4aa5ba13 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" "030dkg5cypd7j9hq0mcqb5gs31lxwmzfq52j81l7v9ldcy5bf5mz"; + src = fetch "openmp" "1dg53wzsci2kra8lh1y0chh60h2l8h1by93br5spzvzlxshkmrqy"; nativeBuildInputs = [ cmake perl ]; buildInputs = [ llvm ]; diff --git a/pkgs/development/compilers/llvm/8/compiler-rt-clock_gettime.patch b/pkgs/development/compilers/llvm/8/compiler-rt-clock_gettime.patch deleted file mode 100644 index f9323ed95c05..000000000000 --- a/pkgs/development/compilers/llvm/8/compiler-rt-clock_gettime.patch +++ /dev/null @@ -1,74 +0,0 @@ -commit f00c7bccf7955b7dfbb4859fd9019e9eb3349f2d -Author: Tobias Mayer <tobim@fastmail.fm> -Date: Wed Feb 13 12:44:17 2019 +0100 - - Provide clock_gettime for xray on macos < 10.12 - -diff --git a/lib/xray/xray_basic_logging.cc b/lib/xray/xray_basic_logging.cc -index a46c151af..38aea6932 100644 ---- a/lib/xray/xray_basic_logging.cc -+++ b/lib/xray/xray_basic_logging.cc -@@ -36,6 +36,29 @@ - #include "xray_tsc.h" - #include "xray_utils.h" - -+#if __MACH__ -+#include <mach/clock.h> -+#include <mach/mach.h> -+enum clockid_t { -+ CLOCK_MONOTONIC = REALTIME_CLOCK, -+ CLOCK_REALTIME = REALTIME_CLOCK -+}; -+ -+int clock_gettime(clockid_t clock_id, struct timespec *ts) { -+ if (ts != NULL) { -+ clock_serv_t cclock; -+ mach_timespec_t mts; -+ host_get_clock_service(mach_host_self(), clock_id, &cclock); -+ clock_get_time(cclock, &mts); -+ mach_port_deallocate(mach_task_self(), cclock); -+ ts->tv_sec = mts.tv_sec; -+ ts->tv_nsec = mts.tv_nsec; -+ return 0; -+ } -+ return -1; -+} -+#endif -+ - namespace __xray { - - SpinMutex LogMutex; -diff --git a/lib/xray/xray_fdr_logging.cc b/lib/xray/xray_fdr_logging.cc -index 4b308b27f..1d044c8fd 100644 ---- a/lib/xray/xray_fdr_logging.cc -+++ b/lib/xray/xray_fdr_logging.cc -@@ -38,6 +38,29 @@ - #include "xray_tsc.h" - #include "xray_utils.h" - -+#if __MACH__ -+#include <mach/clock.h> -+#include <mach/mach.h> -+enum clockid_t { -+ CLOCK_MONOTONIC = REALTIME_CLOCK, -+ CLOCK_REALTIME = REALTIME_CLOCK -+}; -+ -+int clock_gettime(clockid_t clock_id, struct timespec *ts) { -+ if (ts != NULL) { -+ clock_serv_t cclock; -+ mach_timespec_t mts; -+ host_get_clock_service(mach_host_self(), clock_id, &cclock); -+ clock_get_time(cclock, &mts); -+ mach_port_deallocate(mach_task_self(), cclock); -+ ts->tv_sec = mts.tv_sec; -+ ts->tv_nsec = mts.tv_nsec; -+ return 0; -+ } -+ return -1; -+} -+#endif -+ - namespace __xray { - - atomic_sint32_t LoggingStatus = {XRayLogInitStatus::XRAY_LOG_UNINITIALIZED}; diff --git a/pkgs/development/compilers/llvm/8/compiler-rt.nix b/pkgs/development/compilers/llvm/8/compiler-rt.nix index 2b591cc94aff..a8bbb1f719bf 100644 --- a/pkgs/development/compilers/llvm/8/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/8/compiler-rt.nix @@ -34,8 +34,7 @@ stdenv.mkDerivation rec { patches = [ ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory ]# ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch - ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./crtbegin-and-end.patch - ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin ./compiler-rt-clock_gettime.patch; + ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./crtbegin-and-end.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 |