aboutsummaryrefslogtreecommitdiffstats
path: root/main/mariadb/ppc-remove-glibc-dep.patch
diff options
context:
space:
mode:
authorGustavo Romero <gromero@br.ibm.com>2017-03-26 15:08:15 +0000
committerJakub Jirutka <jakub@jirutka.cz>2017-03-26 18:26:41 +0200
commit17f250dd159dbb6a8c5abf794532b434c0e7ca08 (patch)
tree94db49da895ce9d41499d35541206b9d401b9e5b /main/mariadb/ppc-remove-glibc-dep.patch
parent19c7235ef59405f95c9df1b42e366326c4edf2a8 (diff)
downloadaports-17f250dd159dbb6a8c5abf794532b434c0e7ca08.tar.bz2
aports-17f250dd159dbb6a8c5abf794532b434c0e7ca08.tar.xz
aports/mariadb: remove glibc dep on ppc
Remove dependency on glibc by using gcc builtin function and no glibc wrappers. Currently there are no surrogates in musl for: __ppc_get_timebase() __ppc_set_ppr_low() __ppc_set_ppr_med() however glibc __ppc_get_timebase() is just a wrapper for GCC builtin __builtin_get_timebase() available since GCC 4.8 [1], so assuming that aports on ppc64le will never be built using GCC < 4.8 we can just switch directly to the GCC builtin function. Also __ppc_set_ppr_{low,med}() are not available on musl but both are simple glibc wrappers on a single asm instruction, hence there is no harm in using asm directly instead. Actually, using asm directly was the first solution adopted in MariaDB [2]. [1] https://goo.gl/jxLV6O [2] https://goo.gl/9bjuVC
Diffstat (limited to 'main/mariadb/ppc-remove-glibc-dep.patch')
-rw-r--r--main/mariadb/ppc-remove-glibc-dep.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/main/mariadb/ppc-remove-glibc-dep.patch b/main/mariadb/ppc-remove-glibc-dep.patch
new file mode 100644
index 0000000000..72ae1d809e
--- /dev/null
+++ b/main/mariadb/ppc-remove-glibc-dep.patch
@@ -0,0 +1,75 @@
+From f5cf70d9d1dc7f4cbeffb7fb75cbbe08720e3873 Mon Sep 17 00:00:00 2001
+From: Gustavo Romero <gromero@br.ibm.com>
+Date: Sun, 26 Mar 2017 15:08:15 +0000
+Subject: [PATCH] Remove dependency on glibc on PPC
+
+Remove dependency on glibc by using gcc builtin function and no glibc
+wrappers.
+
+Currently there are no surrogates in musl for:
+
+ __ppc_get_timebase()
+ __ppc_set_ppr_low()
+ __ppc_set_ppr_med()
+
+however glibc __ppc_get_timebase() is just a wrapper for GCC builtin
+__builtin_get_timebase() available since GCC 4.8 [1], so assuming that
+aports on ppc64le will never be built using GCC < 4.8 we can just
+switch directly to the GCC builtin function.
+
+Also __ppc_set_ppr_{low,med}() are not available on musl but both
+are simple glibc wrappers on a single asm instruction, hence there
+is no harm in using asm directly instead. Actually, using asm
+directly was the first solution adopted in MariaDB [2].
+
+[1] https://goo.gl/jxLV6O
+[2] https://goo.gl/9bjuVC
+
+--- a/storage/xtradb/include/ut0ut.h
++++ b/storage/xtradb/include/ut0ut.h
+@@ -86,8 +86,7 @@
+ independent way by using YieldProcessor. */
+ # define UT_RELAX_CPU() YieldProcessor()
+ # elif defined(__powerpc__)
+-#include <sys/platform/ppc.h>
+-# define UT_RELAX_CPU() __ppc_get_timebase()
++# define UT_RELAX_CPU() __builtin_ppc_get_timebase()
+ # else
+ # define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
+ # endif
+@@ -101,9 +100,8 @@
+ #endif
+
+ # if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
+-#include <sys/platform/ppc.h>
+-# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
+-# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
++# define UT_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1")
++# define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2")
+ # else
+ # define UT_LOW_PRIORITY_CPU() ((void)0)
+ # define UT_RESUME_PRIORITY_CPU() ((void)0)
+--- a/storage/innobase/include/ut0ut.h
++++ b/storage/innobase/include/ut0ut.h
+@@ -89,8 +89,7 @@
+ independent way by using YieldProcessor. */
+ # define UT_RELAX_CPU() YieldProcessor()
+ # elif defined(__powerpc__)
+-#include <sys/platform/ppc.h>
+-# define UT_RELAX_CPU() __ppc_get_timebase()
++# define UT_RELAX_CPU() __builtin_ppc_get_timebase()
+ # else
+ # define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
+ # endif
+@@ -104,9 +103,8 @@
+ #endif
+
+ # if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
+-#include <sys/platform/ppc.h>
+-# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
+-# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
++# define UT_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1")
++# define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2")
+ # else
+ # define UT_LOW_PRIORITY_CPU() ((void)0)
+ # define UT_RESUME_PRIORITY_CPU() ((void)0)