Commit 9194c3a9 authored by marko's avatar marko

branches/zip: Pass -prefer-non-pic only on IA-32 (x86) when building

the dynamic InnoDB plugin, ha_innodb.so.  This libtool option cannot
be used on every target platform.  For instance, the AMD64 (x86_64) ABI
mandates position-independent code (PIC) in dynamic shared objects.

Makefile.am: Use $(INNODB_CFLAGS) and $(INNODB_DYNAMIC_CFLAGS) in
target-specific CFLAGS and CXXFLAGS variable definitions.

plug.in: Instead of appending to the MySQL-wide CFLAGS, introduce
the variables INNODB_CFLAGS and INNODB_DYNAMIC_CFLAGS.  Depending on
$target_cpu, append -prefer-non-pic to INNODB_DYNAMIC_CFLAGS.
parent 775fd54d
...@@ -175,18 +175,15 @@ libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ ...@@ -175,18 +175,15 @@ libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \
handler/i_s.cc \ handler/i_s.cc \
handler/mysql_addons.cc handler/mysql_addons.cc
libinnobase_a_CXXFLAGS= $(AM_CFLAGS) libinnobase_a_CXXFLAGS= $(AM_CFLAGS) $(INNODB_CFLAGS)
libinnobase_a_CFLAGS = $(AM_CFLAGS) libinnobase_a_CFLAGS = $(AM_CFLAGS) $(INNODB_CFLAGS)
EXTRA_LTLIBRARIES = ha_innodb.la EXTRA_LTLIBRARIES = ha_innodb.la
pkglib_LTLIBRARIES = @plugin_innobase_shared_target@ pkglib_LTLIBRARIES = @plugin_innobase_shared_target@
# To avoid symbol clashes between the InnoDB plugin and a built-in InnoDB,
# we must rename class ha_innobase to something else. Also global symbols
# will have to be redefined, but that can be done by objcopy --redefine-syms.
ha_innodb_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) ha_innodb_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) -prefer-non-pic -DMYSQL_DYNAMIC_PLUGIN ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_CFLAGS = $(AM_CFLAGS) -prefer-non-pic -DMYSQL_DYNAMIC_PLUGIN ha_innodb_la_CFLAGS = $(AM_CFLAGS) $(INNODB_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_SOURCES = $(libinnobase_a_SOURCES) ha_innodb_la_SOURCES = $(libinnobase_a_SOURCES)
EXTRA_DIST = CMakeLists.txt plug.in \ EXTRA_DIST = CMakeLists.txt plug.in \
......
...@@ -12,24 +12,29 @@ MYSQL_PLUGIN_ACTIONS(innobase, [ ...@@ -12,24 +12,29 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
AC_C_BIGENDIAN AC_C_BIGENDIAN
case "$target_os" in case "$target_os" in
lin*) lin*)
CFLAGS="$CFLAGS -DUNIV_LINUX";; INNODB_CFLAGS="-DUNIV_LINUX";;
hpux10*) hpux10*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";; INNODB_CFLAGS="-DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
hp*) hp*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";; INNODB_CFLAGS="-DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
aix*) aix*)
CFLAGS="$CFLAGS -DUNIV_AIX";; INNODB_CFLAGS="-DUNIV_AIX";;
irix*) irix*|osf*|sysv5uw7*|openbsd*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; INNODB_CFLAGS="-DUNIV_MUST_NOT_INLINE";;
osf*) *solaris*|*SunOS*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; INNODB_CFLAGS="-DUNIV_SOLARIS";;
*solaris*|*SunOS*)
CFLAGS="$CFLAGS -DUNIV_SOLARIS";;
sysv5uw7*)
# Problem when linking on SCO
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
openbsd*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
esac esac
INNODB_DYNAMIC_CFLAGS="-DMYSQL_DYNAMIC_PLUGIN"
case "$target_cpu" in
x86_64)
# The AMD64 ABI forbids absolute addresses in shared libraries
;;
*86)
# Use absolute addresses on IA-32
INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
;;
esac
AC_SUBST(INNODB_CFLAGS)
AC_SUBST(INNODB_DYNAMIC_CFLAGS)
]) ])
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