Commit e63377ac authored by vasil's avatar vasil

branches/zip:

Fix Bug#46718 InnoDB plugin incompatible with gcc 4.1 (at least: on PPC): "Undefined symbol"

by implementing our own check in plug.in instead of using the result from
the check from MySQL because it is insufficient.

Approved by:	Marko (rb://154)
parent 13084a65
...@@ -285,7 +285,7 @@ os_fast_mutex_free( ...@@ -285,7 +285,7 @@ os_fast_mutex_free(
/**********************************************************//** /**********************************************************//**
Atomic compare-and-swap and increment for InnoDB. */ Atomic compare-and-swap and increment for InnoDB. */
#ifdef HAVE_GCC_ATOMIC_BUILTINS #ifdef HAVE_IB_GCC_ATOMIC_BUILTINS
/**********************************************************//** /**********************************************************//**
Returns true if swapped, ptr is pointer to target, old_val is value to Returns true if swapped, ptr is pointer to target, old_val is value to
compare to, new_val is the value to swap in. */ compare to, new_val is the value to swap in. */
...@@ -377,7 +377,7 @@ InterlockedExchange() operates on LONG, and the LONG will be ...@@ -377,7 +377,7 @@ InterlockedExchange() operates on LONG, and the LONG will be
clobbered */ clobbered */
# define os_atomic_test_and_set_byte(ptr, new_val) \ # define os_atomic_test_and_set_byte(ptr, new_val) \
((byte) InterlockedExchange(ptr, new_val)) ((byte) InterlockedExchange(ptr, new_val))
#endif /* HAVE_GCC_ATOMIC_BUILTINS */ #endif /* HAVE_IB_GCC_ATOMIC_BUILTINS */
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
#include "os0sync.ic" #include "os0sync.ic"
......
...@@ -125,11 +125,11 @@ if we are compiling on Windows. */ ...@@ -125,11 +125,11 @@ if we are compiling on Windows. */
# include <sched.h> # include <sched.h>
# endif # endif
# if defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_SOLARIS_ATOMICS) \ # if defined(HAVE_IB_GCC_ATOMIC_BUILTINS) || defined(HAVE_SOLARIS_ATOMICS) \
|| defined(HAVE_WINDOWS_ATOMICS) || defined(HAVE_WINDOWS_ATOMICS)
/* If atomics are defined we use them in InnoDB mutex implementation */ /* If atomics are defined we use them in InnoDB mutex implementation */
# define HAVE_ATOMIC_BUILTINS # define HAVE_ATOMIC_BUILTINS
# endif /* (HAVE_GCC_ATOMIC_BUILTINS) || (HAVE_SOLARIS_ATOMICS) # endif /* (HAVE_IB_GCC_ATOMIC_BUILTINS) || (HAVE_SOLARIS_ATOMICS)
|| (HAVE_WINDOWS_ATOMICS) */ || (HAVE_WINDOWS_ATOMICS) */
/* For InnoDB rw_locks to work with atomics we need the thread_id /* For InnoDB rw_locks to work with atomics we need the thread_id
......
...@@ -61,6 +61,57 @@ MYSQL_PLUGIN_ACTIONS(innobase, [ ...@@ -61,6 +61,57 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
;; ;;
esac esac
AC_SUBST(INNODB_DYNAMIC_CFLAGS) AC_SUBST(INNODB_DYNAMIC_CFLAGS)
AC_MSG_CHECKING(whether GCC atomic builtins are available)
AC_TRY_RUN(
[
int main()
{
long x;
long y;
long res;
char c;
x = 10;
y = 123;
res = __sync_bool_compare_and_swap(&x, x, y);
if (!res || x != y) {
return(1);
}
x = 10;
y = 123;
res = __sync_bool_compare_and_swap(&x, x + 1, y);
if (res || x != 10) {
return(1);
}
x = 10;
y = 123;
res = __sync_add_and_fetch(&x, y);
if (res != 123 + 10 || x != 123 + 10) {
return(1);
}
c = 10;
res = __sync_lock_test_and_set(&c, 123);
if (res != 10 || c != 123) {
return(1);
}
return(0);
}
],
[
AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
[GCC atomic builtins are available])
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
]
)
AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins) AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
AC_TRY_RUN( AC_TRY_RUN(
[ [
......
...@@ -1106,7 +1106,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1106,7 +1106,7 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: The InnoDB memory heap is disabled\n"); "InnoDB: The InnoDB memory heap is disabled\n");
} }
#ifdef HAVE_GCC_ATOMIC_BUILTINS #ifdef HAVE_IB_GCC_ATOMIC_BUILTINS
# ifdef INNODB_RW_LOCKS_USE_ATOMICS # ifdef INNODB_RW_LOCKS_USE_ATOMICS
fprintf(stderr, fprintf(stderr,
"InnoDB: Mutexes and rw_locks use GCC atomic builtins.\n"); "InnoDB: Mutexes and rw_locks use GCC atomic builtins.\n");
...@@ -1130,10 +1130,10 @@ innobase_start_or_create_for_mysql(void) ...@@ -1130,10 +1130,10 @@ innobase_start_or_create_for_mysql(void)
fprintf(stderr, fprintf(stderr,
"InnoDB: Mutexes use Windows interlocked functions.\n"); "InnoDB: Mutexes use Windows interlocked functions.\n");
# endif /* INNODB_RW_LOCKS_USE_ATOMICS */ # endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#else /* HAVE_GCC_ATOMIC_BUILTINS */ #else /* HAVE_IB_GCC_ATOMIC_BUILTINS */
fprintf(stderr, fprintf(stderr,
"InnoDB: Neither mutexes nor rw_locks use GCC atomic builtins.\n"); "InnoDB: Neither mutexes nor rw_locks use GCC atomic builtins.\n");
#endif /* HAVE_GCC_ATOMIC_BUILTINS */ #endif /* HAVE_IB_GCC_ATOMIC_BUILTINS */
/* Since InnoDB does not currently clean up all its internal data /* Since InnoDB does not currently clean up all its internal data
structures in MySQL Embedded Server Library server_end(), we structures in MySQL Embedded Server Library server_end(), we
......
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