mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
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>
This commit is contained in:
parent
1a17a5ab80
commit
1cedbaf137
@ -1,5 +1,6 @@
|
||||
Version 2.03.12 -
|
||||
===================================
|
||||
Add configure option --with/out-symvers for non-glibc builds.
|
||||
Report error when the filesystem is missing on fsadm resized volume.
|
||||
Handle better blockdev with --getsize64 support for fsadm.
|
||||
Do not include editline/history.h when using editline library.
|
||||
|
35
configure
vendored
35
configure
vendored
@ -934,6 +934,7 @@ enable_cmirrord
|
||||
with_cmirrord_pidfile
|
||||
enable_debug
|
||||
with_optimisation
|
||||
with_symvers
|
||||
enable_profiling
|
||||
enable_valgrind_pool
|
||||
enable_devmapper
|
||||
@ -1749,6 +1750,8 @@ Optional Packages:
|
||||
--with-cmirrord-pidfile=PATH
|
||||
cmirrord pidfile [PID_DIR/cmirrord.pid]
|
||||
--with-optimisation=OPT C optimisation flag [OPT=-O2]
|
||||
--with-symvers=STYLE use symbol versioning of the shared library
|
||||
[default=gnu]
|
||||
--with-lvmlockd-pidfile=PATH
|
||||
lvmlockd pidfile [PID_DIR/lvmlockd.pid]
|
||||
--with-lvmpolld-pidfile=PATH
|
||||
@ -3103,13 +3106,11 @@ if test -z "$CFLAGS"; then :
|
||||
fi
|
||||
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
|
||||
@ -3124,7 +3125,6 @@ case "$host_os" in
|
||||
;;
|
||||
darwin*)
|
||||
CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
|
||||
CLDFLAGS="${CLDFLAGS-"$LDFLAGS"}"
|
||||
ELDFLAGS=
|
||||
CLDWHOLEARCHIVE="-all_load"
|
||||
CLDNOWHOLEARCHIVE=
|
||||
@ -10393,6 +10393,35 @@ fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $COPTIMISE_FLAG" >&5
|
||||
$as_echo "$COPTIMISE_FLAG" >&6; }
|
||||
|
||||
################################################################################
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use symbol versioning" >&5
|
||||
$as_echo_n "checking whether to use symbol versioning... " >&6; }
|
||||
|
||||
# Check whether --with-symvers was given.
|
||||
if test "${with_symvers+set}" = set; then :
|
||||
withval=$with_symvers; case "$withval" in
|
||||
gnu|no) symvers=$withval ;;
|
||||
*) as_fn_error $? "Unknown argument to with-symvers" "$LINENO" 5 ;;
|
||||
esac
|
||||
else
|
||||
symvers=gnu
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $symvers" >&5
|
||||
$as_echo "$symvers" >&6; }
|
||||
|
||||
if test "$GCC" = "yes" && test "$symvers" = "gnu" ; then
|
||||
|
||||
$as_echo "#define GNU_SYMVER 1" >>confdefs.h
|
||||
|
||||
case "$host_os" in
|
||||
linux*)
|
||||
CLDFLAGS="${CLDFLAGS-"$LDFLAGS"} -Wl,--version-script,.export.sym"
|
||||
LDDEPS="$LDDEPS .export.sym"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to gather gcov profiling data" >&5
|
||||
$as_echo_n "checking whether to gather gcov profiling data... " >&6; }
|
||||
|
26
configure.ac
26
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=
|
||||
@ -825,6 +822,29 @@ AC_ARG_WITH(optimisation,
|
||||
COPTIMISE_FLAG=$withval)
|
||||
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)
|
||||
|
@ -132,6 +132,9 @@
|
||||
/* Path to fsadm binary. */
|
||||
#undef FSADM_PATH
|
||||
|
||||
/* Define to use GNU versioning in the shared library. */
|
||||
#undef GNU_SYMVER
|
||||
|
||||
/* Define to 1 if you have the `alarm' function. */
|
||||
#undef HAVE_ALARM
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
* specified version string.
|
||||
*
|
||||
* Since versioning is only available when compiling with GCC the entire
|
||||
* compatibility version should be enclosed in '#if defined(__GNUC__)',
|
||||
* compatibility version should be enclosed in '#if defined(GNU_SYMVER)',
|
||||
* for example:
|
||||
*
|
||||
* int dm_foo(int bar)
|
||||
@ -62,7 +62,7 @@
|
||||
* versions of library symbols prior to the introduction of symbol
|
||||
* versioning: it must never be used for new symbols.
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
#if defined(GNU_SYMVER)
|
||||
#define DM_EXPORT_SYMBOL(func, ver) \
|
||||
__asm__(".symver " #func "_v" #ver ", " #func "@DM_" #ver )
|
||||
#define DM_EXPORT_SYMBOL_BASE(func) \
|
||||
|
@ -242,7 +242,7 @@ bad:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(GNU_SYMVER)
|
||||
/*
|
||||
* Maintain backward compatibility with older versions that did not
|
||||
* accept a 'min_num_bits' argument to dm_bitset_parse_list().
|
||||
@ -254,6 +254,4 @@ dm_bitset_t dm_bitset_parse_list_v1_02_129(const char *str, struct dm_pool *mem)
|
||||
}
|
||||
DM_EXPORT_SYMBOL(dm_bitset_parse_list, 1_02_129);
|
||||
|
||||
#else /* if defined(__GNUC__) */
|
||||
|
||||
#endif
|
||||
|
@ -2188,7 +2188,7 @@ void dm_lib_exit(void)
|
||||
_version_checked = 0;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(GNU_SYMVER)
|
||||
/*
|
||||
* Maintain binary backward compatibility.
|
||||
* Version script mechanism works with 'gcc' compatible compilers only.
|
||||
|
@ -3849,7 +3849,7 @@ void dm_tree_node_set_callback(struct dm_tree_node *dnode,
|
||||
dnode->callback_data = data;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(GNU_SYMVER)
|
||||
/*
|
||||
* Backward compatible implementations.
|
||||
*
|
||||
|
@ -5069,7 +5069,7 @@ int dm_stats_start_filemapd(int fd, uint64_t group_id, const char *path,
|
||||
* current dm_stats_create_region() version.
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(GNU_SYMVER)
|
||||
int dm_stats_create_region_v1_02_106(struct dm_stats *dms, uint64_t *region_id,
|
||||
uint64_t start, uint64_t len, int64_t step,
|
||||
int precise, const char *program_id,
|
||||
|
@ -37,7 +37,7 @@
|
||||
* specified version string.
|
||||
*
|
||||
* Since versioning is only available when compiling with GCC the entire
|
||||
* compatibility version should be enclosed in '#if defined(__GNUC__)',
|
||||
* compatibility version should be enclosed in '#if defined(GNU_SYMVER)',
|
||||
* for example:
|
||||
*
|
||||
* int dm_foo(int bar)
|
||||
@ -62,7 +62,7 @@
|
||||
* versions of library symbols prior to the introduction of symbol
|
||||
* versioning: it must never be used for new symbols.
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
#if defined(GNU_SYMVER)
|
||||
#define DM_EXPORT_SYMBOL(func, ver) \
|
||||
__asm__(".symver " #func "_v" #ver ", " #func "@DM_" #ver )
|
||||
#define DM_EXPORT_SYMBOL_BASE(func) \
|
||||
|
Loading…
Reference in New Issue
Block a user