summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2021-03-29 21:46:12 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2021-03-30 13:06:19 +0200
commit1cedbaf13778de02e38b5dc80a7af246b7ec83e5 (patch)
tree152ab4ec39c677eb1a349c290952acff641c52f8 /configure.ac
parent1a17a5ab80b1699ac086ad34852116e7728cc378 (diff)
downloadlvm2-1cedbaf13778de02e38b5dc80a7af246b7ec83e5.tar.gz
configure: support builds without versioning
Not all libc (like musl, uclibc dietlibc) libraries support full symbol version resolution in runtime like glibc. Add support to not generate symbol versions when compiling against them. Additionally libdevmapper.so was broken when compiled against uclibc. Runtime linker loader caused calling dm_task_get_info_base() function recursively, leading to segmentation fault. Introduce --with-symvers=STYLE option, which allows to choose between gnu and disabled symbol versioning. By default gnu symbol versioning is used. __GNUC__ check is replaced now with GNU_SYMVER. Additionally ld version script is included only in case of gnu option, which slightly reduces output size. Providing --without-symvers to configure script when building against uclibc library fixes segmentation fault error described above, due to lack of several versions of the same symbol in libdevmapper.so library. Based on: https://patchwork.kernel.org/project/dm-devel/patch/20180831144817.31207-1-m.niestroj@grinn-global.com/ Suggested-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac26
1 files changed, 23 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index b92be0db3..21a1d311e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,13 +30,11 @@ AC_CANONICAL_TARGET([])
AS_IF([test -z "$CFLAGS"], [COPTIMISE_FLAG="-O2"])
case "$host_os" in
linux*)
- CLDFLAGS="${CLDFLAGS-"$LDFLAGS"} -Wl,--version-script,.export.sym"
# equivalent to -rdynamic
ELDFLAGS="-Wl,--export-dynamic"
# FIXME Generate list and use --dynamic-list=.dlopen.sym
CLDWHOLEARCHIVE="-Wl,-whole-archive"
CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
- LDDEPS="$LDDEPS .export.sym"
LIB_SUFFIX=so
DEVMAPPER=yes
BUILD_LVMPOLLD=no
@@ -51,7 +49,6 @@ case "$host_os" in
;;
darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
- CLDFLAGS="${CLDFLAGS-"$LDFLAGS"}"
ELDFLAGS=
CLDWHOLEARCHIVE="-all_load"
CLDNOWHOLEARCHIVE=
@@ -826,6 +823,29 @@ AC_ARG_WITH(optimisation,
AC_MSG_RESULT($COPTIMISE_FLAG)
################################################################################
+dnl -- Symbol versioning
+AC_MSG_CHECKING(whether to use symbol versioning)
+AC_ARG_WITH(symvers,
+ AC_HELP_STRING([--with-symvers=STYLE],
+ [use symbol versioning of the shared library [default=gnu]]),
+ [ case "$withval" in
+ gnu|no) symvers=$withval ;;
+ *) AC_MSG_ERROR(Unknown argument to with-symvers) ;;
+ esac], symvers=gnu)
+AC_MSG_RESULT($symvers)
+
+if test "$GCC" = "yes" && test "$symvers" = "gnu" ; then
+ AC_DEFINE(GNU_SYMVER, 1,
+ [Define to use GNU versioning in the shared library.])
+ case "$host_os" in
+ linux*)
+ CLDFLAGS="${CLDFLAGS-"$LDFLAGS"} -Wl,--version-script,.export.sym"
+ LDDEPS="$LDDEPS .export.sym"
+ ;;
+ esac
+fi
+
+################################################################################
dnl -- Enable profiling
AC_MSG_CHECKING(whether to gather gcov profiling data)
AC_ARG_ENABLE(profiling,