summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-03-15 05:02:20 +0000
committerKhem Raj <raj.khem@gmail.com>2016-03-15 05:02:20 +0000
commitefd9112095b216b5fd20523147650b0f4147e62f (patch)
tree7a5fa47d5a3e8b35ab9d009bc9c3bff3f08e3cb8
parent3d92b955605420840c4925b590eb66e2d42237a4 (diff)
downloadmeta-clang-efd9112095b216b5fd20523147650b0f4147e62f.tar.gz
libcxx,libcxxabi: Fix build on musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--recipes-devtools/clang/files/0001-Use-__GLIBC__-to-differentiate-glibc-like-libc-on-li.patch39
-rw-r--r--recipes-devtools/clang/files/0001-replace-strtoll_l-with-strtoll-on-musl.patch55
-rw-r--r--recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch56
-rw-r--r--recipes-devtools/clang/libcxx_git.bb4
-rw-r--r--recipes-devtools/clang/libcxxabi_git.bb2
5 files changed, 156 insertions, 0 deletions
diff --git a/recipes-devtools/clang/files/0001-Use-__GLIBC__-to-differentiate-glibc-like-libc-on-li.patch b/recipes-devtools/clang/files/0001-Use-__GLIBC__-to-differentiate-glibc-like-libc-on-li.patch
new file mode 100644
index 0000000..dc06ddd
--- /dev/null
+++ b/recipes-devtools/clang/files/0001-Use-__GLIBC__-to-differentiate-glibc-like-libc-on-li.patch
@@ -0,0 +1,39 @@
1From f85abde580d2ba399bfc7538a28f7b6f96912bc6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 15 Mar 2016 03:10:42 +0000
4Subject: [PATCH] Use __GLIBC__ to differentiate glibc-like libc on linux
5
6glibc/uclibc define __GLIBC_PREREQ but musl does not therefore we need
7to check if its on glibc system before using it
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 include/__config | 6 +++---
12 1 file changed, 3 insertions(+), 3 deletions(-)
13
14diff --git a/include/__config b/include/__config
15index db5a832..0859b5f 100644
16--- a/include/__config
17+++ b/include/__config
18@@ -392,15 +392,15 @@ typedef __char32_t char32_t;
19 #elif defined(__ANDROID__)
20 #define _LIBCPP_HAS_QUICK_EXIT
21 #elif defined(__linux__)
22-#if !defined(_LIBCPP_HAS_MUSL_LIBC)
23+#if defined(__GLIBC__)
24 # include <features.h>
25-#if __GLIBC_PREREQ(2, 15)
26+#if __GLIBC_PREREQ(2, 15)
27 #define _LIBCPP_HAS_QUICK_EXIT
28 #endif
29 #if __GLIBC_PREREQ(2, 17)
30 #define _LIBCPP_HAS_C11_FEATURES
31 #endif
32-#else // defined(_LIBCPP_HAS_MUSL_LIBC)
33+#else // defined(__GLIBC__)
34 #define _LIBCPP_HAS_QUICK_EXIT
35 #define _LIBCPP_HAS_C11_FEATURES
36 #endif
37--
381.9.1
39
diff --git a/recipes-devtools/clang/files/0001-replace-strtoll_l-with-strtoll-on-musl.patch b/recipes-devtools/clang/files/0001-replace-strtoll_l-with-strtoll-on-musl.patch
new file mode 100644
index 0000000..6e8404d
--- /dev/null
+++ b/recipes-devtools/clang/files/0001-replace-strtoll_l-with-strtoll-on-musl.patch
@@ -0,0 +1,55 @@
1From 103e1e99622318a6183c4576d372cc8126c6778d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 15 Mar 2016 04:20:10 +0000
4Subject: [PATCH] replace strtoll_l with strtoll on musl
5
6Fixes errors like
7libcxx/include/locale:874:26: error: use of undeclared identifier 'strtoll_l'
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 include/locale | 7 +++----
12 1 file changed, 3 insertions(+), 4 deletions(-)
13
14diff --git a/include/locale b/include/locale
15index 84cb5a5..9072722 100644
16--- a/include/locale
17+++ b/include/locale
18@@ -10,7 +10,6 @@
19
20 #ifndef _LIBCPP_LOCALE
21 #define _LIBCPP_LOCALE
22-
23 /*
24 locale synopsis
25
26@@ -871,7 +870,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
27 typename remove_reference<decltype(errno)>::type __save_errno = errno;
28 errno = 0;
29 char *__p2;
30- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
31+ long long __ll = strtoll(__a, &__p2, __base);
32 typename remove_reference<decltype(errno)>::type __current_errno = errno;
33 if (__current_errno == 0)
34 errno = __save_errno;
35@@ -911,7 +910,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
36 typename remove_reference<decltype(errno)>::type __save_errno = errno;
37 errno = 0;
38 char *__p2;
39- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
40+ unsigned long long __ll = strtoull(__a, &__p2, __base);
41 typename remove_reference<decltype(errno)>::type __current_errno = errno;
42 if (__current_errno == 0)
43 errno = __save_errno;
44@@ -941,7 +940,7 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
45 typename remove_reference<decltype(errno)>::type __save_errno = errno;
46 errno = 0;
47 char *__p2;
48- long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
49+ long double __ld = strtold(__a, &__p2);
50 typename remove_reference<decltype(errno)>::type __current_errno = errno;
51 if (__current_errno == 0)
52 errno = __save_errno;
53--
541.9.1
55
diff --git a/recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch b/recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch
new file mode 100644
index 0000000..f66de8f
--- /dev/null
+++ b/recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch
@@ -0,0 +1,56 @@
1From 21ddd574f6e9b321614d39a7765f1ad98aa09f54 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 15 Mar 2016 04:56:27 +0000
4Subject: [PATCH] use constexpr when using glibc
5
6POSIX does not permit using PTHREAD_COND_INITIALIZER except for static
7initialization, and certainly does not permit using it as a value
8
9also POSIX does not specify the type of the object (it's opaque) so if
10there are any types for which their code would be invalid C++, then their
11code is invalid
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 include/__mutex_base | 11 ++++++++---
16 1 file changed, 8 insertions(+), 3 deletions(-)
17
18diff --git a/include/__mutex_base b/include/__mutex_base
19index b019b47..10ad9f2 100644
20--- a/include/__mutex_base
21+++ b/include/__mutex_base
22@@ -33,7 +33,10 @@ class _LIBCPP_TYPE_VIS mutex
23 public:
24 _LIBCPP_INLINE_VISIBILITY
25 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
26- constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
27+#ifdef __GLIBC__
28+ constexpr
29+#endif
30+ mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
31 #else
32 mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
33 #endif
34@@ -63,7 +66,6 @@ extern const try_to_lock_t try_to_lock;
35 extern const adopt_lock_t adopt_lock;
36
37 #else
38-
39 constexpr defer_lock_t defer_lock = defer_lock_t();
40 constexpr try_to_lock_t try_to_lock = try_to_lock_t();
41 constexpr adopt_lock_t adopt_lock = adopt_lock_t();
42@@ -272,7 +274,10 @@ class _LIBCPP_TYPE_VIS condition_variable
43 public:
44 _LIBCPP_INLINE_VISIBILITY
45 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
46- constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
47+#ifdef __GLIBC__
48+ constexpr
49+#endif
50+ condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
51 #else
52 condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
53 #endif
54--
551.9.1
56
diff --git a/recipes-devtools/clang/libcxx_git.bb b/recipes-devtools/clang/libcxx_git.bb
index e4c124e..ba6ecc2 100644
--- a/recipes-devtools/clang/libcxx_git.bb
+++ b/recipes-devtools/clang/libcxx_git.bb
@@ -23,6 +23,10 @@ SRC_URI = "\
23 ${LLVM_GIT}/libcxx.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=libcxx;destsuffix=git/projects/libcxx \ 23 ${LLVM_GIT}/libcxx.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=libcxx;destsuffix=git/projects/libcxx \
24 ${LLVM_GIT}/libcxxabi.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=libcxxabi;destsuffix=git/projects/libcxxabi \ 24 ${LLVM_GIT}/libcxxabi.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=libcxxabi;destsuffix=git/projects/libcxxabi \
25 " 25 "
26SRC_URI += "file://0001-Use-__GLIBC__-to-differentiate-glibc-like-libc-on-li.patch \
27 file://0001-use-constexpr-when-using-glibc.patch \
28"
29SRC_URI_append_libc-musl = " file://0001-replace-strtoll_l-with-strtoll-on-musl.patch "
26 30
27SRCREV_FORMAT = "llvm_libcxx_libcxxabi" 31SRCREV_FORMAT = "llvm_libcxx_libcxxabi"
28 32
diff --git a/recipes-devtools/clang/libcxxabi_git.bb b/recipes-devtools/clang/libcxxabi_git.bb
index 04c5bdf..2cb2408 100644
--- a/recipes-devtools/clang/libcxxabi_git.bb
+++ b/recipes-devtools/clang/libcxxabi_git.bb
@@ -23,6 +23,8 @@ SRC_URI = "\
23 ${LLVM_GIT}/libcxxabi.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=libcxxabi;destsuffix=git/projects/libcxxabi \ 23 ${LLVM_GIT}/libcxxabi.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=libcxxabi;destsuffix=git/projects/libcxxabi \
24 " 24 "
25 25
26SRC_URI += "file://0001-Use-__GLIBC__-to-differentiate-glibc-like-libc-on-li.patch;patchdir=../libcxx"
27
26SRCREV_FORMAT = "llvm_libcxx_libcxxabi" 28SRCREV_FORMAT = "llvm_libcxx_libcxxabi"
27 29
28S = "${WORKDIR}/git/projects/libcxxabi" 30S = "${WORKDIR}/git/projects/libcxxabi"