From 96cfd14fd277209eb551f7f5be33a417d94f2fd8 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:29:22 -0500 Subject: llvm-3.9: patches to fix w/musl Mostly same as used with LLVM 4.0 --- .../compilers/llvm/3.9/dynamiclibrary-musl.patch | 33 ++++++++++++++++++++++ pkgs/development/compilers/llvm/3.9/llvm.nix | 5 +++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch b/pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch new file mode 100644 index 000000000000..d5d7f07b5e11 --- /dev/null +++ b/pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch @@ -0,0 +1,33 @@ +From d12ecb83d01dcb580dd94f4d57828f33d3eb4c35 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 18 Feb 2016 15:33:21 +0100 +Subject: [PATCH 3/3] Fix DynamicLibrary to build with musl libc + +stdin/out/err is part of the libc and not the kernel so we check for the +specific libc that does the unexpected instead of linux. + +This is needed for making it build with musl libc. +--- + lib/Support/DynamicLibrary.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp +index 9a7aeb5..0c1c8f8 100644 +--- a/lib/Support/DynamicLibrary.cpp ++++ b/lib/Support/DynamicLibrary.cpp +@@ -140,10 +140,10 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { + #define EXPLICIT_SYMBOL(SYM) \ + if (!strcmp(symbolName, #SYM)) return &SYM + +-// On linux we have a weird situation. The stderr/out/in symbols are both ++// On GNU libc we have a weird situation. The stderr/out/in symbols are both + // macros and global variables because of standards requirements. So, we + // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. +-#if defined(__linux__) and !defined(__ANDROID__) ++#if defined(__GLIBC__) + { + EXPLICIT_SYMBOL(stderr); + EXPLICIT_SYMBOL(stdout); +-- +2.7.3 + diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 71b67aa7dc57..c325da3e7376 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -62,7 +62,10 @@ in stdenv.mkDerivation rec { url = https://github.com/llvm-mirror/llvm/commit/5340b5b3d970069aebf3dde49d8964583742e01a.patch; sha256 = "095f8knplwqbc2p7rad1kq8633i34qynni9jna93an7kyc80wdxl"; }) - ]; + ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + ../TLI-musl.patch + ./dynamiclibrary-musl.patch + ]; postPatch = "" + '' -- cgit 1.4.1 From 04fb62878089f4a3a41943f78398d29e23eb6a39 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:30:41 -0500 Subject: llvm_39: unconditionally apply sigaltstack fix (as we do on other LLVM builds) --- pkgs/development/compilers/llvm/3.9/llvm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index c325da3e7376..fa9b9560225c 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -94,7 +94,7 @@ in stdenv.mkDerivation rec { substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib patch -p1 < ./llvm-outputs.patch '' - + stdenv.lib.optionalString (stdenv ? glibc) '' + + '' ( cd projects/compiler-rt patch -p1 < ${ -- cgit 1.4.1 From f0c154a1097b9e25cde8561454d3e60c35f46d86 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:32:38 -0500 Subject: llvm_39: apply llvm_4 compiler-rt patch for musl as well --- pkgs/development/compilers/llvm/3.9/llvm.nix | 2 + .../compilers/llvm/3.9/sanitizers-nongnu.patch | 368 +++++++++++++++++++++ 2 files changed, 370 insertions(+) create mode 100644 pkgs/development/compilers/llvm/3.9/sanitizers-nongnu.patch (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index fa9b9560225c..31677b0ef400 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -107,6 +107,8 @@ in stdenv.mkDerivation rec { substituteInPlace lib/esan/esan_sideline_linux.cpp \ --replace 'struct sigaltstack' 'stack_t' ) + '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' + patch -p1 -i ${./sanitizers-nongnu.patch} -d projects/compiler-rt ''; # hacky fix: created binaries need to be run before installation diff --git a/pkgs/development/compilers/llvm/3.9/sanitizers-nongnu.patch b/pkgs/development/compilers/llvm/3.9/sanitizers-nongnu.patch new file mode 100644 index 000000000000..5bd858f8ae79 --- /dev/null +++ b/pkgs/development/compilers/llvm/3.9/sanitizers-nongnu.patch @@ -0,0 +1,368 @@ +From dac4d3912378069b44340204e5fc6237aa1baf94 Mon Sep 17 00:00:00 2001 +From: Matthias Maier +Date: Fri, 5 May 2017 17:47:39 +0000 +Subject: [PATCH] Musl patches + +Ported to compiler-rt-sanitizers-4.0.0. Taken from + + https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch +--- + lib/asan/asan_linux.cc | 4 +-- + lib/interception/interception_linux.cc | 2 +- + lib/interception/interception_linux.h | 2 +- + lib/msan/msan_linux.cc | 2 +- + .../sanitizer_common_interceptors_ioctl.inc | 4 +-- + lib/sanitizer_common/sanitizer_common_syscalls.inc | 2 +- + lib/sanitizer_common/sanitizer_linux_libcdep.cc | 12 +++---- + lib/sanitizer_common/sanitizer_platform.h | 7 ++++ + .../sanitizer_platform_interceptors.h | 2 +- + .../sanitizer_platform_limits_posix.cc | 39 +++++++++++++--------- + lib/tsan/rtl/tsan_platform_linux.cc | 2 +- + 11 files changed, 46 insertions(+), 32 deletions(-) + +diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc +index c051573dd..e295f6004 100644 +--- a/lib/asan/asan_linux.cc ++++ b/lib/asan/asan_linux.cc +@@ -39,7 +39,7 @@ + #include + #endif + +-#if SANITIZER_ANDROID || SANITIZER_FREEBSD ++#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_NONGNU + #include + extern "C" void* _DYNAMIC; + #else +@@ -80,7 +80,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { + UNIMPLEMENTED(); + } + +-#if SANITIZER_ANDROID ++#if SANITIZER_ANDROID || SANITIZER_NONGNU + // FIXME: should we do anything for Android? + void AsanCheckDynamicRTPrereqs() {} + void AsanCheckIncompatibleRT() {} +diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc +index 6e908ac01..8f23d9adc 100644 +--- a/lib/interception/interception_linux.cc ++++ b/lib/interception/interception_linux.cc +@@ -24,7 +24,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, + return real == wrapper; + } + +-#if !defined(__ANDROID__) // android does not have dlvsym ++#if !defined(__ANDROID__) && !SANITIZER_NONGNU // android does not have dlvsym + void *GetFuncAddrVer(const char *func_name, const char *ver) { + return dlvsym(RTLD_NEXT, func_name, ver); + } +diff --git a/lib/interception/interception_linux.h b/lib/interception/interception_linux.h +index 27a66c882..3b559a303 100644 +--- a/lib/interception/interception_linux.h ++++ b/lib/interception/interception_linux.h +@@ -34,7 +34,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver); + (::__interception::uptr) & (func), \ + (::__interception::uptr) & WRAP(func)) + +-#if !defined(__ANDROID__) // android does not have dlvsym ++#if !defined(__ANDROID__) && !SANITIZER_NONGNU // android does not have dlvsym + #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ + (::__interception::real_##func = (func##_f)( \ + unsigned long)::__interception::GetFuncAddrVer(#func, symver)) +diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc +index 0a687f620..0852d97d7 100644 +--- a/lib/msan/msan_linux.cc ++++ b/lib/msan/msan_linux.cc +@@ -13,7 +13,7 @@ + //===----------------------------------------------------------------------===// + + #include "sanitizer_common/sanitizer_platform.h" +-#if SANITIZER_FREEBSD || SANITIZER_LINUX ++#if SANITIZER_FREEBSD || SANITIZER_LINUX && !SANITIZER_NONGNU + + #include "msan.h" + #include "msan_thread.h" +diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +index 4ed9afedf..64f584e93 100644 +--- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc ++++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +@@ -100,7 +100,7 @@ static void ioctl_table_fill() { + _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz); + #endif + +-#if SANITIZER_LINUX ++#if SANITIZER_LINUX && !SANITIZER_NONGNU + // Conflicting request ids. + // _(CDROMAUDIOBUFSIZ, NONE, 0); + // _(SNDCTL_TMR_CONTINUE, NONE, 0); +@@ -361,7 +361,7 @@ static void ioctl_table_fill() { + _(VT_WAITACTIVE, NONE, 0); + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE + _(CYGETDEFTHRESH, WRITE, sizeof(int)); + _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); +diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc +index 469c8eb7e..24f87867d 100644 +--- a/lib/sanitizer_common/sanitizer_common_syscalls.inc ++++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc +@@ -2038,7 +2038,7 @@ POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) { + } + } + +-#if !SANITIZER_ANDROID ++#if !SANITIZER_ANDROID && !SANITIZER_NONGNU + PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim, + void *old_rlim) { + if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz); +diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc +index f99f0b594..3a773a94e 100644 +--- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc ++++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc +@@ -152,7 +152,7 @@ bool SanitizerGetThreadName(char *name, int max_len) { + #endif + } + +-#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO ++#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU + static uptr g_tls_size; + + #ifdef __i386__ +@@ -180,11 +180,11 @@ void InitTlsSize() { + } + #else + void InitTlsSize() { } +-#endif // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO ++#endif // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU + + #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \ + || defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__)) \ +- && SANITIZER_LINUX && !SANITIZER_ANDROID ++ && SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + // sizeof(struct pthread) from glibc. + static atomic_uintptr_t kThreadDescriptorSize; + +@@ -338,7 +338,7 @@ uptr ThreadSelf() { + + #if !SANITIZER_GO + static void GetTls(uptr *addr, uptr *size) { +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + # if defined(__x86_64__) || defined(__i386__) || defined(__s390__) + *addr = ThreadSelf(); + *size = GetTlsSize(); +@@ -364,7 +364,7 @@ static void GetTls(uptr *addr, uptr *size) { + *addr = (uptr) dtv[2]; + *size = (*addr == 0) ? 0 : ((uptr) segbase[0] - (uptr) dtv[2]); + } +-#elif SANITIZER_ANDROID ++#elif SANITIZER_ANDROID || SANITIZER_NONGNU + *addr = 0; + *size = 0; + #else +@@ -375,7 +375,7 @@ static void GetTls(uptr *addr, uptr *size) { + + #if !SANITIZER_GO + uptr GetTlsSize() { +-#if SANITIZER_FREEBSD || SANITIZER_ANDROID ++#if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NONGNU + uptr addr, size; + GetTls(&addr, &size); + return size; +diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h +index d9a8e8df1..fe01c5744 100644 +--- a/lib/sanitizer_common/sanitizer_platform.h ++++ b/lib/sanitizer_common/sanitizer_platform.h +@@ -162,6 +162,13 @@ + # define SANITIZER_PPC64V2 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 62875d11a..212e6e882 100644 +--- a/lib/sanitizer_common/sanitizer_platform_interceptors.h ++++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h +@@ -23,7 +23,7 @@ + # define SI_NOT_WINDOWS 0 + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + # define SI_LINUX_NOT_ANDROID 1 + #else + # define SI_LINUX_NOT_ANDROID 0 +diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +index 683f019d7..fd4880962 100644 +--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -14,6 +14,8 @@ + + #include "sanitizer_platform.h" + ++#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 +@@ -139,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 +@@ -160,7 +164,8 @@ typedef struct user_fpregs elf_fpregset_t; + # include + #endif + #include +-#include ++// #include ++#include + #include + #include + #include +@@ -252,7 +257,7 @@ namespace __sanitizer { + unsigned struct_itimerspec_sz = sizeof(struct itimerspec); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + unsigned struct_ustat_sz = sizeof(struct ustat); + unsigned struct_rlimit64_sz = sizeof(struct rlimit64); + unsigned struct_statvfs64_sz = sizeof(struct statvfs64); +@@ -310,7 +315,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr)); + unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + #endif + +-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID ++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU + int glob_nomatch = GLOB_NOMATCH; + int glob_altdirfunc = GLOB_ALTDIRFUNC; + #endif +@@ -404,7 +409,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned struct_termios_sz = sizeof(struct termios); + unsigned struct_winsize_sz = sizeof(struct winsize); + +-#if SANITIZER_LINUX ++#if SANITIZER_LINUX && !SANITIZER_NONGNU + unsigned struct_arpreq_sz = sizeof(struct arpreq); + unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf); + unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession); +@@ -454,7 +459,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned struct_vt_mode_sz = sizeof(struct vt_mode); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); + unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); + #if EV_VERSION > (0x010000) +@@ -822,7 +827,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE; + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; + unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; + unsigned IOCTL_CYGETMON = CYGETMON; +@@ -985,7 +990,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); +@@ -1019,6 +1024,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); +@@ -1032,6 +1038,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); +@@ -1134,7 +1141,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); +@@ -1195,7 +1202,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 + +@@ -1245,7 +1252,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); +@@ -1264,7 +1271,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 3313288a7..103c7b6b9 100644 +--- a/lib/tsan/rtl/tsan_platform_linux.cc ++++ b/lib/tsan/rtl/tsan_platform_linux.cc +@@ -287,7 +287,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; + __res_state *statp = (__res_state*)state; + for (int i = 0; i < MAXNS && cnt < nfd; i++) { +-- +2.16.2 + -- cgit 1.4.1 From b39fb5525b4595d5ef647c817f72ee975807fe06 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:34:18 -0500 Subject: llvm_39: set triples as well --- pkgs/development/compilers/llvm/3.9/llvm.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 31677b0ef400..94a8d379fb2c 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -134,6 +134,10 @@ in stdenv.mkDerivation rec { ] ++ stdenv.lib.optionals (buildPlatform != hostPlatform) [ "-DCMAKE_CROSSCOMPILING=True" "-DLLVM_TABLEGEN=${buildPackages.llvmPackages_39.llvm}/bin/llvm-tblgen" + ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" + "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}" ]; postBuild = '' -- cgit 1.4.1 From a1bf9b60943a777a1d2bd2360933729736ec7226 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:37:55 -0500 Subject: llvm_39: disable sanitizers/xray bits when using musl Don't have a fix for this handy and don't need it yet so for now just disable. --- pkgs/development/compilers/llvm/3.9/llvm.nix | 6 +- .../compilers/llvm/3.9/sanitizers-nongnu.patch | 368 --------------------- 2 files changed, 4 insertions(+), 370 deletions(-) delete mode 100644 pkgs/development/compilers/llvm/3.9/sanitizers-nongnu.patch (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 94a8d379fb2c..8fe1ac46ce9a 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -107,8 +107,6 @@ in stdenv.mkDerivation rec { substituteInPlace lib/esan/esan_sideline_linux.cpp \ --replace 'struct sigaltstack' 'stack_t' ) - '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${./sanitizers-nongnu.patch} -d projects/compiler-rt ''; # hacky fix: created binaries need to be run before installation @@ -138,6 +136,10 @@ in stdenv.mkDerivation rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}" + # Not yet supported + "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" + "-DCOMPILER_RT_BUILD_XRAY=OFF" + ]; postBuild = '' diff --git a/pkgs/development/compilers/llvm/3.9/sanitizers-nongnu.patch b/pkgs/development/compilers/llvm/3.9/sanitizers-nongnu.patch deleted file mode 100644 index 5bd858f8ae79..000000000000 --- a/pkgs/development/compilers/llvm/3.9/sanitizers-nongnu.patch +++ /dev/null @@ -1,368 +0,0 @@ -From dac4d3912378069b44340204e5fc6237aa1baf94 Mon Sep 17 00:00:00 2001 -From: Matthias Maier -Date: Fri, 5 May 2017 17:47:39 +0000 -Subject: [PATCH] Musl patches - -Ported to compiler-rt-sanitizers-4.0.0. Taken from - - https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch ---- - lib/asan/asan_linux.cc | 4 +-- - lib/interception/interception_linux.cc | 2 +- - lib/interception/interception_linux.h | 2 +- - lib/msan/msan_linux.cc | 2 +- - .../sanitizer_common_interceptors_ioctl.inc | 4 +-- - lib/sanitizer_common/sanitizer_common_syscalls.inc | 2 +- - lib/sanitizer_common/sanitizer_linux_libcdep.cc | 12 +++---- - lib/sanitizer_common/sanitizer_platform.h | 7 ++++ - .../sanitizer_platform_interceptors.h | 2 +- - .../sanitizer_platform_limits_posix.cc | 39 +++++++++++++--------- - lib/tsan/rtl/tsan_platform_linux.cc | 2 +- - 11 files changed, 46 insertions(+), 32 deletions(-) - -diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc -index c051573dd..e295f6004 100644 ---- a/lib/asan/asan_linux.cc -+++ b/lib/asan/asan_linux.cc -@@ -39,7 +39,7 @@ - #include - #endif - --#if SANITIZER_ANDROID || SANITIZER_FREEBSD -+#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_NONGNU - #include - extern "C" void* _DYNAMIC; - #else -@@ -80,7 +80,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { - UNIMPLEMENTED(); - } - --#if SANITIZER_ANDROID -+#if SANITIZER_ANDROID || SANITIZER_NONGNU - // FIXME: should we do anything for Android? - void AsanCheckDynamicRTPrereqs() {} - void AsanCheckIncompatibleRT() {} -diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc -index 6e908ac01..8f23d9adc 100644 ---- a/lib/interception/interception_linux.cc -+++ b/lib/interception/interception_linux.cc -@@ -24,7 +24,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, - return real == wrapper; - } - --#if !defined(__ANDROID__) // android does not have dlvsym -+#if !defined(__ANDROID__) && !SANITIZER_NONGNU // android does not have dlvsym - void *GetFuncAddrVer(const char *func_name, const char *ver) { - return dlvsym(RTLD_NEXT, func_name, ver); - } -diff --git a/lib/interception/interception_linux.h b/lib/interception/interception_linux.h -index 27a66c882..3b559a303 100644 ---- a/lib/interception/interception_linux.h -+++ b/lib/interception/interception_linux.h -@@ -34,7 +34,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver); - (::__interception::uptr) & (func), \ - (::__interception::uptr) & WRAP(func)) - --#if !defined(__ANDROID__) // android does not have dlvsym -+#if !defined(__ANDROID__) && !SANITIZER_NONGNU // android does not have dlvsym - #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ - (::__interception::real_##func = (func##_f)( \ - unsigned long)::__interception::GetFuncAddrVer(#func, symver)) -diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc -index 0a687f620..0852d97d7 100644 ---- a/lib/msan/msan_linux.cc -+++ b/lib/msan/msan_linux.cc -@@ -13,7 +13,7 @@ - //===----------------------------------------------------------------------===// - - #include "sanitizer_common/sanitizer_platform.h" --#if SANITIZER_FREEBSD || SANITIZER_LINUX -+#if SANITIZER_FREEBSD || SANITIZER_LINUX && !SANITIZER_NONGNU - - #include "msan.h" - #include "msan_thread.h" -diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc -index 4ed9afedf..64f584e93 100644 ---- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc -+++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc -@@ -100,7 +100,7 @@ static void ioctl_table_fill() { - _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz); - #endif - --#if SANITIZER_LINUX -+#if SANITIZER_LINUX && !SANITIZER_NONGNU - // Conflicting request ids. - // _(CDROMAUDIOBUFSIZ, NONE, 0); - // _(SNDCTL_TMR_CONTINUE, NONE, 0); -@@ -361,7 +361,7 @@ static void ioctl_table_fill() { - _(VT_WAITACTIVE, NONE, 0); - #endif - --#if SANITIZER_LINUX && !SANITIZER_ANDROID -+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU - // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE - _(CYGETDEFTHRESH, WRITE, sizeof(int)); - _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); -diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc -index 469c8eb7e..24f87867d 100644 ---- a/lib/sanitizer_common/sanitizer_common_syscalls.inc -+++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc -@@ -2038,7 +2038,7 @@ POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) { - } - } - --#if !SANITIZER_ANDROID -+#if !SANITIZER_ANDROID && !SANITIZER_NONGNU - PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim, - void *old_rlim) { - if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz); -diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc -index f99f0b594..3a773a94e 100644 ---- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc -+++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc -@@ -152,7 +152,7 @@ bool SanitizerGetThreadName(char *name, int max_len) { - #endif - } - --#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO -+#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU - static uptr g_tls_size; - - #ifdef __i386__ -@@ -180,11 +180,11 @@ void InitTlsSize() { - } - #else - void InitTlsSize() { } --#endif // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO -+#endif // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU - - #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \ - || defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__)) \ -- && SANITIZER_LINUX && !SANITIZER_ANDROID -+ && SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU - // sizeof(struct pthread) from glibc. - static atomic_uintptr_t kThreadDescriptorSize; - -@@ -338,7 +338,7 @@ uptr ThreadSelf() { - - #if !SANITIZER_GO - static void GetTls(uptr *addr, uptr *size) { --#if SANITIZER_LINUX && !SANITIZER_ANDROID -+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU - # if defined(__x86_64__) || defined(__i386__) || defined(__s390__) - *addr = ThreadSelf(); - *size = GetTlsSize(); -@@ -364,7 +364,7 @@ static void GetTls(uptr *addr, uptr *size) { - *addr = (uptr) dtv[2]; - *size = (*addr == 0) ? 0 : ((uptr) segbase[0] - (uptr) dtv[2]); - } --#elif SANITIZER_ANDROID -+#elif SANITIZER_ANDROID || SANITIZER_NONGNU - *addr = 0; - *size = 0; - #else -@@ -375,7 +375,7 @@ static void GetTls(uptr *addr, uptr *size) { - - #if !SANITIZER_GO - uptr GetTlsSize() { --#if SANITIZER_FREEBSD || SANITIZER_ANDROID -+#if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NONGNU - uptr addr, size; - GetTls(&addr, &size); - return size; -diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h -index d9a8e8df1..fe01c5744 100644 ---- a/lib/sanitizer_common/sanitizer_platform.h -+++ b/lib/sanitizer_common/sanitizer_platform.h -@@ -162,6 +162,13 @@ - # define SANITIZER_PPC64V2 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 62875d11a..212e6e882 100644 ---- a/lib/sanitizer_common/sanitizer_platform_interceptors.h -+++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h -@@ -23,7 +23,7 @@ - # define SI_NOT_WINDOWS 0 - #endif - --#if SANITIZER_LINUX && !SANITIZER_ANDROID -+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU - # define SI_LINUX_NOT_ANDROID 1 - #else - # define SI_LINUX_NOT_ANDROID 0 -diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -index 683f019d7..fd4880962 100644 ---- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -@@ -14,6 +14,8 @@ - - #include "sanitizer_platform.h" - -+#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 -@@ -139,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 -@@ -160,7 +164,8 @@ typedef struct user_fpregs elf_fpregset_t; - # include - #endif - #include --#include -+// #include -+#include - #include - #include - #include -@@ -252,7 +257,7 @@ namespace __sanitizer { - unsigned struct_itimerspec_sz = sizeof(struct itimerspec); - #endif // SANITIZER_LINUX || SANITIZER_FREEBSD - --#if SANITIZER_LINUX && !SANITIZER_ANDROID -+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU - unsigned struct_ustat_sz = sizeof(struct ustat); - unsigned struct_rlimit64_sz = sizeof(struct rlimit64); - unsigned struct_statvfs64_sz = sizeof(struct statvfs64); -@@ -310,7 +315,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr)); - unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); - #endif - --#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID -+#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU - int glob_nomatch = GLOB_NOMATCH; - int glob_altdirfunc = GLOB_ALTDIRFUNC; - #endif -@@ -404,7 +409,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); - unsigned struct_termios_sz = sizeof(struct termios); - unsigned struct_winsize_sz = sizeof(struct winsize); - --#if SANITIZER_LINUX -+#if SANITIZER_LINUX && !SANITIZER_NONGNU - unsigned struct_arpreq_sz = sizeof(struct arpreq); - unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf); - unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession); -@@ -454,7 +459,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); - unsigned struct_vt_mode_sz = sizeof(struct vt_mode); - #endif // SANITIZER_LINUX || SANITIZER_FREEBSD - --#if SANITIZER_LINUX && !SANITIZER_ANDROID -+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU - unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); - unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); - #if EV_VERSION > (0x010000) -@@ -822,7 +827,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); - unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE; - #endif // SANITIZER_LINUX || SANITIZER_FREEBSD - --#if SANITIZER_LINUX && !SANITIZER_ANDROID -+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU - unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; - unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; - unsigned IOCTL_CYGETMON = CYGETMON; -@@ -985,7 +990,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); -@@ -1019,6 +1024,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); -@@ -1032,6 +1038,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); -@@ -1134,7 +1141,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); -@@ -1195,7 +1202,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 - -@@ -1245,7 +1252,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); -@@ -1264,7 +1271,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 3313288a7..103c7b6b9 100644 ---- a/lib/tsan/rtl/tsan_platform_linux.cc -+++ b/lib/tsan/rtl/tsan_platform_linux.cc -@@ -287,7 +287,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; - __res_state *statp = (__res_state*)state; - for (int i = 0; i < MAXNS && cnt < nfd; i++) { --- -2.16.2 - -- cgit 1.4.1 From 182de524a1339cf00b186fe277a5aeefc3ac982c Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:45:55 -0500 Subject: llvm_{39,4}: refactor to use same patch file --- .../compilers/llvm/3.9/dynamiclibrary-musl.patch | 33 ---------------------- pkgs/development/compilers/llvm/3.9/llvm.nix | 2 +- .../compilers/llvm/4/dynamiclibrary-musl.patch | 33 ---------------------- pkgs/development/compilers/llvm/4/llvm.nix | 2 +- .../compilers/llvm/dynamiclibrary-musl.patch | 33 ++++++++++++++++++++++ 5 files changed, 35 insertions(+), 68 deletions(-) delete mode 100644 pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch delete mode 100644 pkgs/development/compilers/llvm/4/dynamiclibrary-musl.patch create mode 100644 pkgs/development/compilers/llvm/dynamiclibrary-musl.patch (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch b/pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch deleted file mode 100644 index d5d7f07b5e11..000000000000 --- a/pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d12ecb83d01dcb580dd94f4d57828f33d3eb4c35 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Thu, 18 Feb 2016 15:33:21 +0100 -Subject: [PATCH 3/3] Fix DynamicLibrary to build with musl libc - -stdin/out/err is part of the libc and not the kernel so we check for the -specific libc that does the unexpected instead of linux. - -This is needed for making it build with musl libc. ---- - lib/Support/DynamicLibrary.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp -index 9a7aeb5..0c1c8f8 100644 ---- a/lib/Support/DynamicLibrary.cpp -+++ b/lib/Support/DynamicLibrary.cpp -@@ -140,10 +140,10 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { - #define EXPLICIT_SYMBOL(SYM) \ - if (!strcmp(symbolName, #SYM)) return &SYM - --// On linux we have a weird situation. The stderr/out/in symbols are both -+// On GNU libc we have a weird situation. The stderr/out/in symbols are both - // macros and global variables because of standards requirements. So, we - // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. --#if defined(__linux__) and !defined(__ANDROID__) -+#if defined(__GLIBC__) - { - EXPLICIT_SYMBOL(stderr); - EXPLICIT_SYMBOL(stdout); --- -2.7.3 - diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 8fe1ac46ce9a..708e471bd4ac 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -64,7 +64,7 @@ in stdenv.mkDerivation rec { }) ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ ../TLI-musl.patch - ./dynamiclibrary-musl.patch + ../dynamiclibrary-musl.patch ]; postPatch = "" diff --git a/pkgs/development/compilers/llvm/4/dynamiclibrary-musl.patch b/pkgs/development/compilers/llvm/4/dynamiclibrary-musl.patch deleted file mode 100644 index d5d7f07b5e11..000000000000 --- a/pkgs/development/compilers/llvm/4/dynamiclibrary-musl.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d12ecb83d01dcb580dd94f4d57828f33d3eb4c35 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Thu, 18 Feb 2016 15:33:21 +0100 -Subject: [PATCH 3/3] Fix DynamicLibrary to build with musl libc - -stdin/out/err is part of the libc and not the kernel so we check for the -specific libc that does the unexpected instead of linux. - -This is needed for making it build with musl libc. ---- - lib/Support/DynamicLibrary.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp -index 9a7aeb5..0c1c8f8 100644 ---- a/lib/Support/DynamicLibrary.cpp -+++ b/lib/Support/DynamicLibrary.cpp -@@ -140,10 +140,10 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { - #define EXPLICIT_SYMBOL(SYM) \ - if (!strcmp(symbolName, #SYM)) return &SYM - --// On linux we have a weird situation. The stderr/out/in symbols are both -+// On GNU libc we have a weird situation. The stderr/out/in symbols are both - // macros and global variables because of standards requirements. So, we - // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. --#if defined(__linux__) and !defined(__ANDROID__) -+#if defined(__GLIBC__) - { - EXPLICIT_SYMBOL(stderr); - EXPLICIT_SYMBOL(stdout); --- -2.7.3 - diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix index a371296db326..06bcd74456c4 100644 --- a/pkgs/development/compilers/llvm/4/llvm.nix +++ b/pkgs/development/compilers/llvm/4/llvm.nix @@ -83,7 +83,7 @@ in stdenv.mkDerivation (rec { patch -p0 < ${../aarch64.patch} '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' patch -p1 -i ${../TLI-musl.patch} - patch -p1 -i ${./dynamiclibrary-musl.patch} + patch -p1 -i ${../dynamiclibrary-musl.patch} patch -p1 -i ${./sanitizers-nongnu.patch} -d projects/compiler-rt ''; diff --git a/pkgs/development/compilers/llvm/dynamiclibrary-musl.patch b/pkgs/development/compilers/llvm/dynamiclibrary-musl.patch new file mode 100644 index 000000000000..d5d7f07b5e11 --- /dev/null +++ b/pkgs/development/compilers/llvm/dynamiclibrary-musl.patch @@ -0,0 +1,33 @@ +From d12ecb83d01dcb580dd94f4d57828f33d3eb4c35 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 18 Feb 2016 15:33:21 +0100 +Subject: [PATCH 3/3] Fix DynamicLibrary to build with musl libc + +stdin/out/err is part of the libc and not the kernel so we check for the +specific libc that does the unexpected instead of linux. + +This is needed for making it build with musl libc. +--- + lib/Support/DynamicLibrary.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp +index 9a7aeb5..0c1c8f8 100644 +--- a/lib/Support/DynamicLibrary.cpp ++++ b/lib/Support/DynamicLibrary.cpp +@@ -140,10 +140,10 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { + #define EXPLICIT_SYMBOL(SYM) \ + if (!strcmp(symbolName, #SYM)) return &SYM + +-// On linux we have a weird situation. The stderr/out/in symbols are both ++// On GNU libc we have a weird situation. The stderr/out/in symbols are both + // macros and global variables because of standards requirements. So, we + // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. +-#if defined(__linux__) and !defined(__ANDROID__) ++#if defined(__GLIBC__) + { + EXPLICIT_SYMBOL(stderr); + EXPLICIT_SYMBOL(stdout); +-- +2.7.3 + -- cgit 1.4.1 From 4ef4e0f44b4a4ed7d0cb6082ef24f2ce25d556b8 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:47:04 -0500 Subject: llvm_38: always apply sigaltstack patch --- pkgs/development/compilers/llvm/3.8/llvm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.8/llvm.nix b/pkgs/development/compilers/llvm/3.8/llvm.nix index 2c65234b6a47..30d40a84b4e7 100644 --- a/pkgs/development/compilers/llvm/3.8/llvm.nix +++ b/pkgs/development/compilers/llvm/3.8/llvm.nix @@ -49,7 +49,7 @@ in stdenv.mkDerivation rec { --replace 'set(CMAKE_INSTALL_NAME_DIR "@rpath")' "set(CMAKE_INSTALL_NAME_DIR "$out/lib")" \ --replace 'set(CMAKE_INSTALL_RPATH "@executable_path/../lib")' "" '' - + stdenv.lib.optionalString (stdenv ? glibc) '' + + '' ( cd projects/compiler-rt patch -p1 < ${ -- cgit 1.4.1 From 68351290ad701dd655311a9fb557266993362d00 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:51:22 -0500 Subject: llvm_38: musl patches + options Same as those added to llvm_39 a few commits ago. --- pkgs/development/compilers/llvm/3.8/llvm.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.8/llvm.nix b/pkgs/development/compilers/llvm/3.8/llvm.nix index 30d40a84b4e7..b847a67e7e3f 100644 --- a/pkgs/development/compilers/llvm/3.8/llvm.nix +++ b/pkgs/development/compilers/llvm/3.8/llvm.nix @@ -36,8 +36,12 @@ in stdenv.mkDerivation rec { # Fix a segfault in llc # See http://lists.llvm.org/pipermail/llvm-dev/2016-October/106500.html - patches = [ ./D17533-1.patch ] ++ - stdenv.lib.optionals (!stdenv.isDarwin) [./fix-llvm-config.patch]; + patches = [ ./D17533-1.patch ] + ++ stdenv.lib.optional (!stdenv.isDarwin) ./fix-llvm-config.patch + ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + ../TLI-musl.patch + ../dynamiclibrary-musl.patch + ]; # hacky fix: New LLVM releases require a newer macOS SDK than # 10.9. This is a temporary measure until nixpkgs darwin support is @@ -81,6 +85,14 @@ in stdenv.mkDerivation rec { ++ stdenv.lib.optionals ( isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" "-DCAN_TARGET_i386=false" + ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" + "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}" + # Not yet supported + "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" + "-DCOMPILER_RT_BUILD_XRAY=OFF" + ]; postBuild = '' -- cgit 1.4.1 From ebcdd8b9b01afa9bbe57d432a00063a008c5f1e6 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:55:48 -0500 Subject: llvm_4: refactor patch location, will be sharing shortly --- .../compilers/llvm/4/libc++/default.nix | 2 +- .../compilers/llvm/4/libc++/max_align_t.patch | 54 ---------------------- pkgs/development/compilers/llvm/4/libc++abi.nix | 2 +- .../compilers/llvm/libcxx-max_align_t.patch | 54 ++++++++++++++++++++++ 4 files changed, 56 insertions(+), 56 deletions(-) delete mode 100644 pkgs/development/compilers/llvm/4/libc++/max_align_t.patch create mode 100644 pkgs/development/compilers/llvm/libcxx-max_align_t.patch (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/4/libc++/default.nix b/pkgs/development/compilers/llvm/4/libc++/default.nix index 718abc420a97..6ce9c0d4792b 100644 --- a/pkgs/development/compilers/llvm/4/libc++/default.nix +++ b/pkgs/development/compilers/llvm/4/libc++/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { ./xlocale-glibc-2.26.patch ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ ../../libcxx-0001-musl-hacks.patch - ./max_align_t.patch + ../../libcxx-max_align_t.patch ]; prePatch = '' diff --git a/pkgs/development/compilers/llvm/4/libc++/max_align_t.patch b/pkgs/development/compilers/llvm/4/libc++/max_align_t.patch deleted file mode 100644 index 060be5b23de8..000000000000 --- a/pkgs/development/compilers/llvm/4/libc++/max_align_t.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 917331c88bd2afce0cf0fdbcab55a64541b5bcf0 Mon Sep 17 00:00:00 2001 -From: "David L. Jones" -Date: Fri, 10 Feb 2017 01:27:42 +0000 -Subject: [PATCH] Check for musl-libc's max_align_t in addition to other - variants. - -Summary: -Libcxx will define its own max_align_t when it is not available. However, the -availability checks today only check for Clang's definition and GCC's -definition. In particular, it does not check for musl's definition, which is the -same as GCC's but guarded with a different macro. - -Reviewers: mclow.lists, EricWF - -Reviewed By: EricWF - -Subscribers: chandlerc, cfe-commits - -Differential Revision: https://reviews.llvm.org/D28478 - -git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294683 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - include/cstddef | 3 ++- - include/stddef.h | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/include/cstddef b/include/cstddef -index edd106c00..103898b7d 100644 ---- a/include/cstddef -+++ b/include/cstddef -@@ -48,7 +48,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD - using ::ptrdiff_t; - using ::size_t; - --#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) -+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \ -+ defined(__DEFINED_max_align_t) - // Re-use the compiler's max_align_t where possible. - using ::max_align_t; - #else -diff --git a/include/stddef.h b/include/stddef.h -index 8841bbea2..faf8552d8 100644 ---- a/include/stddef.h -+++ b/include/stddef.h -@@ -53,7 +53,8 @@ using std::nullptr_t; - } - - // Re-use the compiler's max_align_t where possible. --#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) -+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \ -+ !defined(__DEFINED_max_align_t) - typedef long double max_align_t; - #endif - diff --git a/pkgs/development/compilers/llvm/4/libc++abi.nix b/pkgs/development/compilers/llvm/4/libc++abi.nix index 41eb40e124eb..5eeec395b97a 100644 --- a/pkgs/development/compilers/llvm/4/libc++abi.nix +++ b/pkgs/development/compilers/llvm/4/libc++abi.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation { export TRIPLE=x86_64-apple-darwin '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch} - patch -p1 -d $(ls -d libcxx-*) -i ${./libc++/max_align_t.patch} + patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch} ''; installPhase = if stdenv.isDarwin diff --git a/pkgs/development/compilers/llvm/libcxx-max_align_t.patch b/pkgs/development/compilers/llvm/libcxx-max_align_t.patch new file mode 100644 index 000000000000..060be5b23de8 --- /dev/null +++ b/pkgs/development/compilers/llvm/libcxx-max_align_t.patch @@ -0,0 +1,54 @@ +From 917331c88bd2afce0cf0fdbcab55a64541b5bcf0 Mon Sep 17 00:00:00 2001 +From: "David L. Jones" +Date: Fri, 10 Feb 2017 01:27:42 +0000 +Subject: [PATCH] Check for musl-libc's max_align_t in addition to other + variants. + +Summary: +Libcxx will define its own max_align_t when it is not available. However, the +availability checks today only check for Clang's definition and GCC's +definition. In particular, it does not check for musl's definition, which is the +same as GCC's but guarded with a different macro. + +Reviewers: mclow.lists, EricWF + +Reviewed By: EricWF + +Subscribers: chandlerc, cfe-commits + +Differential Revision: https://reviews.llvm.org/D28478 + +git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294683 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + include/cstddef | 3 ++- + include/stddef.h | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/include/cstddef b/include/cstddef +index edd106c00..103898b7d 100644 +--- a/include/cstddef ++++ b/include/cstddef +@@ -48,7 +48,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD + using ::ptrdiff_t; + using ::size_t; + +-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) ++#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \ ++ defined(__DEFINED_max_align_t) + // Re-use the compiler's max_align_t where possible. + using ::max_align_t; + #else +diff --git a/include/stddef.h b/include/stddef.h +index 8841bbea2..faf8552d8 100644 +--- a/include/stddef.h ++++ b/include/stddef.h +@@ -53,7 +53,8 @@ using std::nullptr_t; + } + + // Re-use the compiler's max_align_t where possible. +-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) ++#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \ ++ !defined(__DEFINED_max_align_t) + typedef long double max_align_t; + #endif + -- cgit 1.4.1 From dd4299a27c1cfdb8ac8e355c96051f278ec9734a Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 11:59:12 -0500 Subject: llvm_39: musl patches, same as llvm_4 --- pkgs/development/compilers/llvm/3.9/libc++/default.nix | 9 +++++++-- pkgs/development/compilers/llvm/3.9/libc++abi.nix | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/libc++/default.nix b/pkgs/development/compilers/llvm/3.9/libc++/default.nix index 7e5c30bdfd35..da18e10c68a6 100644 --- a/pkgs/development/compilers/llvm/3.9/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.9/libc++/default.nix @@ -17,7 +17,12 @@ stdenv.mkDerivation rec { patches = [ # glibc 2.26 fix ./xlocale-glibc-2.26.patch - ] ++ lib.optional stdenv.isDarwin ./darwin.patch; + ] + ++ lib.optional stdenv.isDarwin ./darwin.patch + ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + ../../libcxx-0001-musl-hacks.patch + ../../libcxx-max_align_t.patch + ]; buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; @@ -25,7 +30,7 @@ stdenv.mkDerivation rec { "-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; diff --git a/pkgs/development/compilers/llvm/3.9/libc++abi.nix b/pkgs/development/compilers/llvm/3.9/libc++abi.nix index dc508757ab6d..dffb207a32b6 100644 --- a/pkgs/development/compilers/llvm/3.9/libc++abi.nix +++ b/pkgs/development/compilers/llvm/3.9/libc++abi.nix @@ -15,6 +15,9 @@ stdenv.mkDerivation { export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include" '' + 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} + patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch} ''; installPhase = if stdenv.isDarwin -- cgit 1.4.1 From e4fffae0cfa8d3b5c1337c1c07573ee8e8eb7aaa Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 12:06:41 -0500 Subject: llvmPackages_39.libcxx: minor cleanup --- pkgs/development/compilers/llvm/3.9/libc++/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/libc++/default.nix b/pkgs/development/compilers/llvm/3.9/libc++/default.nix index da18e10c68a6..bd2cc19d2e0b 100644 --- a/pkgs/development/compilers/llvm/3.9/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.9/libc++/default.nix @@ -24,12 +24,13 @@ stdenv.mkDerivation rec { ../../libcxx-max_align_t.patch ]; - buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; + nativeBuildInputs = [ cmake ]; + buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; cmakeFlags = [ - "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" - "-DLIBCXX_LIBCPPABI_VERSION=2" - "-DLIBCXX_CXX_ABI=libcxxabi" + "-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; -- cgit 1.4.1 From ae78847b50fc28ac9c219d7d35e89290107f8fae Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 12:08:32 -0500 Subject: clang_39: fix w/musl (same as clang_4) --- pkgs/development/compilers/llvm/3.9/clang/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.9/clang/default.nix b/pkgs/development/compilers/llvm/3.9/clang/default.nix index 1f6d80ab3be9..f597c559dba6 100644 --- a/pkgs/development/compilers/llvm/3.9/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.9/clang/default.nix @@ -29,6 +29,8 @@ let postPatch = '' sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp + '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' + sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp ''; outputs = [ "out" "lib" "python" ]; -- cgit 1.4.1 From 0b7cc25d19e910a00d39e45813976692ebf02749 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 12:09:57 -0500 Subject: clang_38: musl fixup, cmake should be nativeBuildInput --- pkgs/development/compilers/llvm/3.8/clang/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.8/clang/default.nix b/pkgs/development/compilers/llvm/3.8/clang/default.nix index 05893704d872..cc25a41b0400 100644 --- a/pkgs/development/compilers/llvm/3.8/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.8/clang/default.nix @@ -13,7 +13,8 @@ let mv clang-tools-extra-* $sourceRoot/tools/extra ''; - buildInputs = [ cmake libxml2 llvm python ]; + nativeBuildInputs = [ cmake ]; + buildInputs = [ libxml2 llvm python ]; cmakeFlags = [ "-DCMAKE_CXX_FLAGS=-std=c++11" @@ -27,6 +28,8 @@ let postPatch = '' sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp + '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' + sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp ''; outputs = [ "out" "lib" "python" ]; -- cgit 1.4.1 From db7041a0471924ad17c9bf6308fbfd4eea15209c Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 23 Jun 2018 12:11:18 -0500 Subject: libc++{,abi}_38: musl fixes, cmake is nativeBuildInput --- pkgs/development/compilers/llvm/3.8/libc++/default.nix | 13 ++++++++++--- pkgs/development/compilers/llvm/3.8/libc++abi.nix | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/llvm/3.8/libc++/default.nix b/pkgs/development/compilers/llvm/3.8/libc++/default.nix index cc3f5545146c..5a0410302f2f 100644 --- a/pkgs/development/compilers/llvm/3.8/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.8/libc++/default.nix @@ -17,15 +17,22 @@ stdenv.mkDerivation rec { patches = [ # glibc 2.26 fix ../../3.9/libc++/xlocale-glibc-2.26.patch - ] ++ lib.optional stdenv.isDarwin ./darwin.patch; + ] + ++ lib.optional stdenv.isDarwin ./darwin.patch + ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + ../../libcxx-0001-musl-hacks.patch + ../../libcxx-max_align_t.patch + ]; + + nativeBuildInputs = [ cmake ]; - buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; + 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; diff --git a/pkgs/development/compilers/llvm/3.8/libc++abi.nix b/pkgs/development/compilers/llvm/3.8/libc++abi.nix index 45fb7b5be4f6..8b25681c2dbf 100644 --- a/pkgs/development/compilers/llvm/3.8/libc++abi.nix +++ b/pkgs/development/compilers/llvm/3.8/libc++abi.nix @@ -15,6 +15,9 @@ stdenv.mkDerivation { export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include" '' + 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} + patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch} ''; installPhase = if stdenv.isDarwin -- cgit 1.4.1