plugin-loader: Add facility to register plugin constructors

Enabled when building monolithically and statically.

This should allow us to work around the -whole-archive issue with
libtool.  If the libraries register the plugin constructors they provide
they reference the constructors and will therefore prevent the linker from
removing these seemingly unused symbols from the final executable.

For use cases where dlsym() can be used, e.g. because the static libraries
are manually linked with -whole-archive (Linux) or -force-load (Apple),
this can be disabled by passing ss_cv_static_plugin_constructors=no to
the configure script.
This commit is contained in:
Tobias Brunner
2017-05-23 18:29:12 +02:00
parent 6ce649a8a6
commit 1a06bf03f9
3 changed files with 87 additions and 4 deletions
+18 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2007-2015 Tobias Brunner
# Copyright (C) 2007-2017 Tobias Brunner
# Copyright (C) 2006-2016 Andreas Steffen
# Copyright (C) 2006-2014 Martin Willi
# HSR Hochschule fuer Technik Rapperswil
@@ -1303,6 +1303,19 @@ AM_CONDITIONAL(PYTHON_EGGS_INSTALL, [test "x$python_eggs_install" = xtrue])
AM_CONDITIONAL(PERL_CPAN_INSTALL, [test "x$perl_cpan_install" = xtrue])
AC_CACHE_CHECK(
[if plugin constructors should be resolved statically],
[ss_cv_static_plugin_constructors],
[if test x$monolithic = xtrue -a x$enable_static = xyes; then
ss_cv_static_plugin_constructors=yes
else
ss_cv_static_plugin_constructors="no (enabled for static, monolithic builds)"
fi]
)
if test "x$ss_cv_static_plugin_constructors" = xyes; then
static_plugin_constructors=true
fi
# ===============================================
# collect plugin list for strongSwan components
# ===============================================
@@ -1678,6 +1691,7 @@ AM_CONDITIONAL(USE_IMCV, test x$imcv = xtrue)
AM_CONDITIONAL(USE_TROUSERS, test x$tss_trousers = xtrue)
AM_CONDITIONAL(USE_TSS2, test x$tss_tss2 = xtrue)
AM_CONDITIONAL(MONOLITHIC, test x$monolithic = xtrue)
AM_CONDITIONAL(STATIC_PLUGIN_CONSTRUCTORS, test x$static_plugin_constructors = xtrue)
AM_CONDITIONAL(USE_SILENT_RULES, test x$enable_silent_rules = xyes)
AM_CONDITIONAL(COVERAGE, test x$coverage = xtrue)
AM_CONDITIONAL(USE_DBGHELP, test x$dbghelp_backtraces = xtrue)
@@ -1709,6 +1723,9 @@ fi
if test x$monolithic = xtrue; then
AC_DEFINE([MONOLITHIC], [], [monolithic build embedding plugins])
fi
if test x$static_plugin_constructors = xtrue; then
AC_DEFINE([STATIC_PLUGIN_CONSTRUCTORS], [], [static plugin constructors])
fi
if test x$ikev1 = xtrue; then
AC_DEFINE([USE_IKEV1], [], [support for IKEv1 protocol])
fi