Commit 71e11bce authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-8791 - AIX: Unresolved Symbols during linking

Clean-up nolock.h: it doesn't serve any purpose anymore. Appropriate code moved
to x86-gcc.h and my_atomic.h.

If gcc sync bultins were detected, we want to make use of them independently of
__GNUC__ definition. E.g. XLC simulates those, but doesn't define __GNUC__.

HS/Spider: According to AIX manual alloca() returns char*, which cannot be
casted to any type with static_cast. Use explicit cast instead.

MDL: Removed namemangling pragma, which didn't let MariaDB build with XLC.

WSREP: _int64 seem to be conflicting name with XLC, replaced with _integer64.

CONNECT: RTLD_NOLOAD is GNU extention. Removed rather meaningless check if
library is loaded. Multiple dlopen()'s of the same library are permitted,
and it never gets closed anyway. Except for error, which was a bug: it may
close library, which can still be referenced by other subsystems.

InnoDB: __ppc_get_timebase() is GNU extention. Only use it when __GLIBC__ is
defined.

Based on contribution by flynn1973.
parent 40ad9466
#ifndef ATOMIC_NOLOCK_INCLUDED
#define ATOMIC_NOLOCK_INCLUDED
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \
|| defined(HAVE_GCC_ATOMIC_BUILTINS) \
|| defined(HAVE_SOLARIS_ATOMIC)
# ifdef MY_ATOMIC_MODE_DUMMY
# define LOCK_prefix ""
# else
# define LOCK_prefix "lock"
# endif
/*
We choose implementation as follows:
------------------------------------
On Windows using Visual C++ the native implementation should be
preferrable. When using gcc we prefer the Solaris implementation
before the gcc because of stability preference, we choose gcc
builtins if available, otherwise we choose the somewhat broken
native x86 implementation. If neither Visual C++ or gcc we still
choose the Solaris implementation on Solaris (mainly for SunStudio
compilers).
*/
# if defined(_MSC_VER)
# include "generic-msvc.h"
# elif __GNUC__
# if defined(HAVE_SOLARIS_ATOMIC)
# include "solaris.h"
# elif defined(HAVE_GCC_ATOMIC_BUILTINS)
# include "gcc_builtins.h"
# elif defined(__i386__) || defined(__x86_64__)
# include "x86-gcc.h"
# endif
# elif defined(HAVE_SOLARIS_ATOMIC)
# include "solaris.h"
# endif
#endif
#endif /* ATOMIC_NOLOCK_INCLUDED */
......@@ -28,6 +28,12 @@
*/
#undef MY_ATOMIC_HAS_8_AND_16
#ifdef MY_ATOMIC_MODE_DUMMY
#define LOCK_prefix ""
#else
#define LOCK_prefix "lock"
#endif
#ifdef __x86_64__
# ifdef MY_ATOMIC_NO_XADD
# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd"
......
......@@ -112,9 +112,26 @@
#undef MY_ATOMIC_HAS_8_16
/*
* Attempt to do atomic ops without locks
*/
#include "atomic/nolock.h"
We choose implementation as follows:
------------------------------------
On Windows using Visual C++ the native implementation should be
preferrable. When using gcc we prefer the Solaris implementation
before the gcc because of stability preference, we choose gcc
builtins if available, otherwise we choose the somewhat broken
native x86 implementation. If neither Visual C++ or gcc we still
choose the Solaris implementation on Solaris (mainly for SunStudio
compilers).
*/
#if defined(_MSC_VER)
#include "atomic/generic-msvc.h"
#elif defined(HAVE_SOLARIS_ATOMIC)
#include "atomic/solaris.h"
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#include "atomic/gcc_builtins.h"
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#include "atomic/x86-gcc.h"
#endif
#ifndef make_atomic_cas_body
/* nolock.h was not able to generate even a CAS function, fall back */
......
......@@ -35,7 +35,7 @@ typedef std::allocator<int> allocator_type;
#if 1
#define DENA_ALLOCA_ALLOCATE(typ, len) \
static_cast<typ *>(alloca((len) * sizeof(typ)))
(typ *) alloca((len) * sizeof(typ))
#define DENA_ALLOCA_FREE(x)
#else
#define DENA_ALLOCA_ALLOCATE(typ, len) \
......
......@@ -15,15 +15,6 @@
along with this program; if not, write to the Free Software Foundation,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#if defined(__IBMC__) || defined(__IBMCPP__)
/* Further down, "next_in_lock" and "next_in_context" have the same type,
and in "sql_plist.h" this leads to an identical signature, which causes
problems in function overloading.
*/
#pragma namemangling(v5)
#endif
#include "sql_plist.h"
#include <my_sys.h>
#include <m_string.h>
......
......@@ -670,7 +670,7 @@ int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff,
v->name = thd->strdup(sv->name);
switch (sv->type) {
case WSREP_VAR_INT64:
v->value = (char*)thd->memdup(&sv->value._int64, sizeof(longlong));
v->value = (char*)thd->memdup(&sv->value._integer64, sizeof(longlong));
v->type = SHOW_LONGLONG;
break;
case WSREP_VAR_STRING:
......
......@@ -534,7 +534,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
#endif // 0
// Is the library already loaded?
if (!Hdll && !(Hdll = dlopen(soname, RTLD_NOLOAD)))
if (!Hdll)
// Load the desired shared library
if (!(Hdll = dlopen(soname, RTLD_LAZY))) {
error = dlerror();
......
......@@ -70,7 +70,7 @@ typedef time_t ib_time_t;
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor. */
# define UT_RELAX_CPU() YieldProcessor()
# elif defined(__powerpc__)
# elif defined(__powerpc__) && defined __GLIBC__
#include <sys/platform/ppc.h>
# define UT_RELAX_CPU() do { \
volatile lint volatile_var = __ppc_get_timebase(); \
......
......@@ -31,7 +31,7 @@ extern "C" {
#if 1
#define DENA_ALLOCA_ALLOCATE(typ, len) \
static_cast<typ *>(alloca((len) * sizeof(typ)))
(typ *) alloca((len) * sizeof(typ))
#define DENA_ALLOCA_FREE(x)
#else
#define DENA_ALLOCA_ALLOCATE(typ, len) \
......
......@@ -85,7 +85,7 @@ struct ut_when_dtor {
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor. */
# define UT_RELAX_CPU() YieldProcessor()
# elif defined(__powerpc__)
# elif defined(__powerpc__) && defined __GLIBC__
#include <sys/platform/ppc.h>
# define UT_RELAX_CPU() do { \
volatile lint volatile_var = __ppc_get_timebase(); \
......
......@@ -502,7 +502,7 @@ struct wsrep_stats_var
const char* name; //!< variable name
wsrep_var_type_t type; //!< variable value type
union {
int64_t _int64;
int64_t _integer64;
double _double;
const char* _string;
} value; //!< variable value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment