diff options
author | Colin Walters <walters@verbum.org> | 2012-12-01 14:49:49 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2012-12-05 14:05:17 -0500 |
commit | 68a4a3eea119704817f540efa803e2197fe52838 (patch) | |
tree | a2e0625e7f1c36bd5874499ddb533248e7937347 | |
parent | e6a55a30004feeed5ee05296aac85731b236bfa4 (diff) | |
download | gobject-introspection-68a4a3eea119704817f540efa803e2197fe52838.tar.gz |
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
-rw-r--r-- | Makefile-girepository.am | 5 | ||||
-rw-r--r-- | configure.ac | 21 |
2 files changed, 25 insertions, 1 deletions
diff --git a/Makefile-girepository.am b/Makefile-girepository.am index eb55a548..11549d44 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 74a44de6..b1e8ea9f 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 |