summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2013-09-02 13:59:18 -0400
committerAlexandre Rostovtsev <tetromino@gentoo.org>2014-04-10 01:38:41 -0400
commit2b178c762fbc0706031e9890ba190233e243a602 (patch)
tree950e112052d9824c488eea3bcd51f4c36f482eaf /configure.ac
parent7089cf89672b70711b0ebe10fdd24cd73f6060d5 (diff)
downloadglib-2b178c762fbc0706031e9890ba190233e243a602.tar.gz
glib-2b178c762fbc0706031e9890ba190233e243a602.tar.bz2
glib-2b178c762fbc0706031e9890ba190233e243a602.zip
gobject: try to link with -Wl,-z,nodelete
Since the type system does not support reloading its data and assumes that libgobject remains loaded for the lifetime of the process, we should link libgobject with a flag indicating that it can't be unloaded. https://bugzilla.gnome.org/show_bug.cgi?id=707298
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac34
1 files changed, 34 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index b94e6f3cc..806b6dfe2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3469,6 +3469,40 @@ fi
AC_SUBST(GLIB_LINK_FLAGS)
dnl
+dnl Check for -z,nodelete linker flag: the type system assumes that
+dnl libgobject stays loaded for the lifetime of the process.
+dnl Since ld.bfd does not treat wrong -z options as fatal by default,
+dnl we also try to check for the --fatal-warnings linker flag if
+dnl auto-detecting.
+dnl
+
+AC_ARG_ENABLE([znodelete],
+ [AS_HELP_STRING([--disable-znodelete],
+ [avoid linking with -z,nodelete])],,
+ [SAVED_LDFLAGS="${LDFLAGS}"
+ AC_MSG_CHECKING([for --fatal-warnings linker flag])
+ LDFLAGS=-Wl,--fatal-warnings
+ AC_TRY_LINK([], [int main (void) { return 0; }],
+ AC_MSG_RESULT(yes)
+ [ldflags_fatal=-Wl,--fatal-warnings],
+ AC_MSG_RESULT(no)
+ ldflags_fatal=)
+ AC_MSG_CHECKING([for -z,nodelete linker flag])
+ LDFLAGS="$ldflags_fatal -Wl,-z,nodelete"
+ AC_TRY_LINK([], [int main (void) { return 0; }],
+ AC_MSG_RESULT(yes)
+ enable_znodelete=yes,
+ AC_MSG_RESULT(no)
+ enable_znodelete=no)
+ LDFLAGS="${SAVED_LDFLAGS}"])
+
+if test "x${enable_znodelete}" = "xyes"; then
+ GOBJECT_LINK_FLAGS=-Wl,-z,nodelete
+fi
+
+AC_SUBST(GOBJECT_LINK_FLAGS)
+
+dnl
dnl Check for -fvisibility=hidden to determine if we can do GNU-style
dnl visibility attributes for symbol export control
dnl