From 3734408962fbd36388811c67160ec0253df08e12 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 22 Jun 2010 12:13:31 +0100 Subject: [PATCH] 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. --- clutter/Makefile.am | 5 ++--- configure.ac | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/clutter/Makefile.am b/clutter/Makefile.am index 50385398a..75017804d 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -285,6 +285,7 @@ nodist_libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_SOURCES = \ $(built_source_h) libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LDFLAGS = \ + $(CLUTTER_LINK_FLAGS) \ $(CLUTTER_LT_LDFLAGS) \ $(GCOV_LDFLAGS) \ -export-dynamic \ @@ -293,9 +294,7 @@ libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LDFLAGS = \ $(win32_resources_ldflag) \ $(NULL) -lib_LTLIBRARIES = $(CLUTTER_WINSYS_LIB) - -EXTRA_LTLIBRARIES = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la +lib_LTLIBRARIES = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la clutterdir = $(includedir)/clutter-$(CLUTTER_API_VERSION)/clutter clutter_HEADERS = \ diff --git a/configure.ac b/configure.ac index 3a1efd692..93b443caf 100644 --- a/configure.ac +++ b/configure.ac @@ -88,6 +88,7 @@ CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION" AC_SUBST(CLUTTER_LT_VERSION) AC_SUBST(CLUTTER_LT_LDFLAGS) +AC_SUBST(CLUTTER_LINK_FLAGS) dnl ======================================================================== @@ -106,6 +107,21 @@ AM_PATH_GLIB_2_0([2.18.0], [have_glib=yes], [have_glib=no], [gobject gthread gmodule-no-export]) 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 ======================================================================== # defaults