Use -Bsymbolic-functions

The -Bsymbolic-functions linker flag allows to avoid intra-library
PLT jumps on ELF platforms. It is similar to the aliasing hack in
GLib and GTK+, but definitely less messy.

The configure script should look for the flags, in order to support
platforms/linkers that do not have it.
This commit is contained in:
Emmanuele Bassi 2010-06-22 12:13:31 +01:00
parent c2b8a0272b
commit 3734408962
2 changed files with 18 additions and 3 deletions

View File

@ -285,6 +285,7 @@ nodist_libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_SOURCES = \
$(built_source_h) $(built_source_h)
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LDFLAGS = \ libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LDFLAGS = \
$(CLUTTER_LINK_FLAGS) \
$(CLUTTER_LT_LDFLAGS) \ $(CLUTTER_LT_LDFLAGS) \
$(GCOV_LDFLAGS) \ $(GCOV_LDFLAGS) \
-export-dynamic \ -export-dynamic \
@ -293,9 +294,7 @@ libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LDFLAGS = \
$(win32_resources_ldflag) \ $(win32_resources_ldflag) \
$(NULL) $(NULL)
lib_LTLIBRARIES = $(CLUTTER_WINSYS_LIB) lib_LTLIBRARIES = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
EXTRA_LTLIBRARIES = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
clutterdir = $(includedir)/clutter-$(CLUTTER_API_VERSION)/clutter clutterdir = $(includedir)/clutter-$(CLUTTER_API_VERSION)/clutter
clutter_HEADERS = \ clutter_HEADERS = \

View File

@ -88,6 +88,7 @@ CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"
AC_SUBST(CLUTTER_LT_VERSION) AC_SUBST(CLUTTER_LT_VERSION)
AC_SUBST(CLUTTER_LT_LDFLAGS) AC_SUBST(CLUTTER_LT_LDFLAGS)
AC_SUBST(CLUTTER_LINK_FLAGS)
dnl ======================================================================== dnl ========================================================================
@ -106,6 +107,21 @@ AM_PATH_GLIB_2_0([2.18.0], [have_glib=yes], [have_glib=no],
[gobject gthread gmodule-no-export]) [gobject gthread gmodule-no-export])
AS_IF([test "x$have_glib" = "xno"], AC_MSG_ERROR([glib-2.0 is required])) AS_IF([test "x$have_glib" = "xno"], AC_MSG_ERROR([glib-2.0 is required]))
# Check for -Bsymbolic-functions to avoid intra-library PLT jumps
clutter_LDFLAGS="${LDFLAGS}"
AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
LDFLAGS=-Wl,-Bsymbolic-functions
AC_TRY_LINK([], [int main (void) { return 0; }],
[
CLUTTER_LINK_FLAGS=-Wl[,]-Bsymbolic-functions
AC_MSG_RESULT([yes])
],
[
CLUTTER_LINK_FLAGS=
AC_MSG_RESULT([no])
])
LDFLAGS="${clutter_LDFLAGS}"
dnl ======================================================================== dnl ========================================================================
# defaults # defaults