aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-dbs
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-04-03 12:40:14 -0700
committerKhem Raj <raj.khem@gmail.com>2021-04-06 09:02:12 -0700
commitbd8e72c1397f700fca0ddc44120abf9d325fd872 (patch)
treee3b63f13681c05b639abe945a1366e50ca0fbc33 /meta-oe/recipes-dbs
parent7e64cce442c14f026a5e43cd5d90416c9f81343a (diff)
downloadmeta-openembedded-contrib-bd8e72c1397f700fca0ddc44120abf9d325fd872.tar.gz
mariadb: Fix build on newer 32bit architectures
newer 32bit arches e.g. RV32 and ARC do not have __NR_io_getevents syscall and have started of with 64bit time_t so there is no 32bit version Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-dbs')
-rw-r--r--meta-oe/recipes-dbs/mysql/mariadb.inc2
-rw-r--r--meta-oe/recipes-dbs/mysql/mariadb/0001-aio_linux-Check-if-syscall-exists-before-using-it.patch43
-rw-r--r--meta-oe/recipes-dbs/mysql/mariadb/sys_futex.patch22
3 files changed, 67 insertions, 0 deletions
diff --git a/meta-oe/recipes-dbs/mysql/mariadb.inc b/meta-oe/recipes-dbs/mysql/mariadb.inc
index 67cfa54f02..9833b28857 100644
--- a/meta-oe/recipes-dbs/mysql/mariadb.inc
+++ b/meta-oe/recipes-dbs/mysql/mariadb.inc
@@ -20,6 +20,8 @@ SRC_URI = "https://downloads.mariadb.org/interstitial/${BP}/source/${BP}.tar.gz
file://fix-arm-atomic.patch \
file://0001-Fix-library-LZ4-lookup.patch \
file://0001-innobase-Define-__NR_futex-if-it-does-not-exist.patch \
+ file://0001-aio_linux-Check-if-syscall-exists-before-using-it.patch \
+ file://sys_futex.patch \
"
SRC_URI_append_libc-musl = " file://ppc-remove-glibc-dep.patch"
diff --git a/meta-oe/recipes-dbs/mysql/mariadb/0001-aio_linux-Check-if-syscall-exists-before-using-it.patch b/meta-oe/recipes-dbs/mysql/mariadb/0001-aio_linux-Check-if-syscall-exists-before-using-it.patch
new file mode 100644
index 0000000000..a2f7812c50
--- /dev/null
+++ b/meta-oe/recipes-dbs/mysql/mariadb/0001-aio_linux-Check-if-syscall-exists-before-using-it.patch
@@ -0,0 +1,43 @@
+From 5d9a869a72420cf0bb08b6aa93e980df90bdcf2e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 3 Apr 2021 12:02:36 -0700
+Subject: [PATCH] aio_linux: Check if syscall exists before using it
+
+Return -ENOSYS if not implememented, fixes build on arches like RISCV32
+Fixes
+tpool/aio_linux.cc:63:20: error: '__NR_io_getevents' was not declared in this scope; did you mean 'io_getevents'?
+ 63 | int ret= syscall(__NR_io_getevents, reinterpret_cast<long>(ctx),
+ | ^~~~~~~~~~~~~~~~~
+ | io_getevents
+
+Upstream-Staus: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ tpool/aio_linux.cc | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc
+index d9aa8be2..d8a87a8f 100644
+--- a/tpool/aio_linux.cc
++++ b/tpool/aio_linux.cc
+@@ -59,6 +59,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
+ */
+ static int my_getevents(io_context_t ctx, long min_nr, long nr, io_event *ev)
+ {
++#ifdef __NR_io_getevents
+ int saved_errno= errno;
+ int ret= syscall(__NR_io_getevents, reinterpret_cast<long>(ctx),
+ min_nr, nr, ev, 0);
+@@ -68,6 +69,9 @@ static int my_getevents(io_context_t ctx, long min_nr, long nr, io_event *ev)
+ errno= saved_errno;
+ }
+ return ret;
++#else
++ return -ENOSYS;
++#endif
+ }
+ #endif
+
+--
+2.31.1
+
diff --git a/meta-oe/recipes-dbs/mysql/mariadb/sys_futex.patch b/meta-oe/recipes-dbs/mysql/mariadb/sys_futex.patch
new file mode 100644
index 0000000000..3277a3eee1
--- /dev/null
+++ b/meta-oe/recipes-dbs/mysql/mariadb/sys_futex.patch
@@ -0,0 +1,22 @@
+ Use SYS_futex for syscall
+
+glibc defines SYS_futex and on newer 32bit CPUs like RISCV-32, arc there
+is no 32bit time_t therefore define SYS_futex in terms of SYS_futex_time64
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+--- a/storage/innobase/include/ib0mutex.h
++++ b/storage/innobase/include/ib0mutex.h
+@@ -150,6 +150,12 @@ private:
+ #include <linux/futex.h>
+ #include <sys/syscall.h>
+
++/** Newer 32bit CPUs eg. RISCV-32 are defaulting to 64bit time_t from get go and
++ therefore do not define __NR_futex */
++#if !defined(SYS_futex) && defined(SYS_futex_time64)
++# define SYS_futex SYS_futex_time64
++#endif
++
+ /** Mutex implementation that used the Linux futex. */
+ template <template <typename> class Policy>
+ struct TTASFutexMutex {