summary refs log tree commit diff
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-06-23 11:29:22 -0500
committerWill Dietz <w@wdtz.org>2018-06-23 15:53:43 -0500
commit96cfd14fd277209eb551f7f5be33a417d94f2fd8 (patch)
tree444fdea13575d40e1f548f2004501ebe819d2719
parent75a006c32e76c147cd85969b28a173beacf788ec (diff)
downloadnixlib-96cfd14fd277209eb551f7f5be33a417d94f2fd8.tar
nixlib-96cfd14fd277209eb551f7f5be33a417d94f2fd8.tar.gz
nixlib-96cfd14fd277209eb551f7f5be33a417d94f2fd8.tar.bz2
nixlib-96cfd14fd277209eb551f7f5be33a417d94f2fd8.tar.lz
nixlib-96cfd14fd277209eb551f7f5be33a417d94f2fd8.tar.xz
nixlib-96cfd14fd277209eb551f7f5be33a417d94f2fd8.tar.zst
nixlib-96cfd14fd277209eb551f7f5be33a417d94f2fd8.zip
llvm-3.9: patches to fix w/musl
Mostly same as used with LLVM 4.0
-rw-r--r--pkgs/development/compilers/llvm/3.9/dynamiclibrary-musl.patch33
-rw-r--r--pkgs/development/compilers/llvm/3.9/llvm.nix5
2 files changed, 37 insertions, 1 deletions
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 <ncopa@alpinelinux.org>
+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 = ""
   + ''