about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/llvm/7
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-02-24 01:09:00 +0000
committerAlyssa Ross <hi@alyssa.is>2019-02-24 01:09:00 +0000
commit072c01a28f865e9487df09aed7ddff328252fb36 (patch)
tree6df6e652915940255f294ed8998cce1c4c7c2d40 /nixpkgs/pkgs/development/compilers/llvm/7
parent024b46ff20027c15322e5d868ecec42632556d4b (diff)
parent969cff2691a02b3d7e5468beda26c482d8986644 (diff)
downloadnixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.gz
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.bz2
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.lz
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.xz
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.zst
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.zip
Merge commit '969cff2691a02b3d7e5468beda26c482d8986644'
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/llvm/7')
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt-clock_gettime.patch74
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/default.nix1
3 files changed, 77 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt-clock_gettime.patch b/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt-clock_gettime.patch
new file mode 100644
index 000000000000..f9323ed95c05
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt-clock_gettime.patch
@@ -0,0 +1,74 @@
+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/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix b/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix
index 25c38db470d9..dff9cb9c49c0 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix
@@ -1,5 +1,4 @@
 { stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
-with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "compiler-rt-${version}";
   inherit version;
@@ -16,7 +15,8 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
-  ] ++ optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch;
+  ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
+  ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin ./compiler-rt-clock_gettime.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/nixpkgs/pkgs/development/compilers/llvm/7/default.nix b/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
index 47c6e9e383f3..3f1192d96263 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
@@ -59,6 +59,7 @@ let
 
     libcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
+      libcxx = targetLlvmLibraries.libcxx;
       extraPackages = [
         targetLlvmLibraries.libcxx
         targetLlvmLibraries.libcxxabi