From: Colin Walters Date: Sat, 1 Dec 2012 19:49:49 +0000 (-0500) Subject: build: Use -Bsymbolic-functions by default if available X-Git-Tag: GOBJECT_INTROSPECTION_1_35_3~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68a4a3eea119704817f540efa803e2197fe52838;p=platform%2Fupstream%2Fgobject-introspection.git build: Use -Bsymbolic-functions by default if available While we have much larger performance problems right now, using -Bsymbolic-functions to avoid internal PLT indirection is an easy win. This is the same code that both GLib and GTK+ have. https://bugzilla.gnome.org/show_bug.cgi?id=689456 --- diff --git a/Makefile-girepository.am b/Makefile-girepository.am index eb55a54..11549d4 100644 --- a/Makefile-girepository.am +++ b/Makefile-girepository.am @@ -72,7 +72,10 @@ libgirepository_1_0_la_SOURCES = \ libgirepository_1_0_la_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -DG_IREPOSITORY_COMPILATION libgirepository_1_0_la_LIBADD = libgirepository-gthash.la $(GIREPO_LIBS) -libgirepository_1_0_la_LDFLAGS = -no-undefined -version-number 1:0:0 -export-symbols $(srcdir)/girepository/girepository.symbols +libgirepository_1_0_la_LDFLAGS = \ + $(EXTRA_LINK_FLAGS) \ + -no-undefined -version-number 1:0:0 \ + -export-symbols $(srcdir)/girepository/girepository.symbols gdumpdir = $(datadir)/gobject-introspection-1.0/ gdump_DATA = girepository/gdump.c diff --git a/configure.ac b/configure.ac index 74a44de..b1e8ea9 100644 --- a/configure.ac +++ b/configure.ac @@ -287,7 +287,28 @@ AM_CONDITIONAL(WITH_GLIBSRC, test x"$GLIBSRC" != x) AC_SUBST(GLIBSRC) AC_MSG_RESULT([$GLIBSRC]) +dnl +dnl Check for -Bsymbolic-functions linker flag used to avoid +dnl intra-library PLT jumps, if available. +dnl +AC_ARG_ENABLE(Bsymbolic, + [AS_HELP_STRING([--disable-Bsymbolic], + [avoid linking with -Bsymbolic])],, + [SAVED_LDFLAGS="${LDFLAGS}" + AC_MSG_CHECKING([for -Bsymbolic-functions linker flag]) + LDFLAGS=-Wl,-Bsymbolic-functions + AC_TRY_LINK([], [int main (void) { return 0; }], + AC_MSG_RESULT(yes) + enable_Bsymbolic=yes, + AC_MSG_RESULT(no) + enable_Bsymbolic=no) + LDFLAGS="${SAVED_LDFLAGS}"]) + +if test "x${enable_Bsymbolic}" = "xyes"; then + EXTRA_LINK_FLAGS=-Wl,-Bsymbolic-functions +fi +AC_SUBST(EXTRA_LINK_FLAGS) AC_CONFIG_FILES([ Makefile