[json-glib/json-glib-0-16] build: Add configure option to enable -Bsymbolic



commit 9fba70ca3aa3b9e33714367984ae176c9e4978db
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Jul 11 16:49:14 2013 +0100

    build: Add configure option to enable -Bsymbolic
    
    We should always compile with -Bsymbolic enabled to avoid intra-library
    PLT jumps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703734
    (cherry picked from commit a9327484746820a5a2b8c1acf4a78470b004f0a0)
    
    Signed-off-by: Emmanuele Bassi <ebassi gnome org>

 configure.ac |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a84dbb3..ae7c1e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,30 @@ AC_MSG_RESULT([$platform_win32])
 AM_CONDITIONAL(OS_LINUX, [test "$platform_linux" = "yes"])
 AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"])
 
+# Check for -Bsymbolic-functions to avoid intra-library PLT jumps
+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}"
+              ])
+
+AS_IF([test "x$enable_Bsymbolic" = "xyes"], [JSON_LINK_FLAGS=-Wl[,]-Bsymbolic-functions])
+JSON_LT_LDFLAGS="$JSON_LT_LDFLAGS $JSON_LINK_FLAGS"
+
 AC_SUBST(JSON_LT_LDFLAGS)
 
 dnl === Dependencies ==========================================================


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]