void-packages/srcpkgs/mariadb/patches/musl-ppc.patch
q66 a8a793b66f mariadb: simplify handling of atomics/libatomic, fix ppc32 build
Platforms such as ppc32 and mips do not have the __sync builtins
in gcc, which breaks compilation. However, that code is not even
necessary, as proper implementations of the higher level atomic
primitives are available as builtins in any modern toolchain
(and definitely ours) and mariadb in fact already uses those
when available.

So basically ditch all this effectively dead code to fix build
on those platforms. While at it, remove the wrong checks in
cmake and fix properly linking against libatomic only when
needed (this also affects ARMv5/6) and simplify the template.

These changes have already been done upstream, but we're
sticking with an older version for now because of libmysqlclient
ABI compat, so fix this downstream until we can upgrade.

Also add another patch for ppc/ppc64+musl to use a gcc builtin
instead of a glibc extension.

[ci skip]
2019-10-16 20:50:49 +02:00

27 lines
1 KiB
Diff

This header does not exist on musl, but there has been a
builtin for this in gcc for ages, so just use that instead.
--- storage/innobase/include/ut0ut.h
+++ storage/innobase/include/ut0ut.h
@@ -89,8 +89,7 @@ struct ut_when_dtor {
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
--- storage/xtradb/include/ut0ut.h
+++ storage/xtradb/include/ut0ut.h
@@ -86,8 +86,7 @@ struct ut_when_dtor {
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