Commit a31e4905 authored by Niels Möller's avatar Niels Möller

Merge branch 'versioned-symbols' into master

parents bb6be1a9 af011b1c
......@@ -68,3 +68,5 @@ core
/nettle.tps
/nettle.vr
/nettle.vrs
/libhogweed.map
/libnettle.map
......@@ -268,6 +268,25 @@
* gcm.h (GCM_SET_KEY, GCM_ENCRYPT, GCM_DECRYPT, GCM_DIGEST):
Likewise.
2014-12-08 Niels Möller <nisse@lysator.liu.se>
* aclocal.m4 (LD_VERSION_SCRIPT): Linker scripts no longer located
in the source tree.
* configure.ac (LIBNETTLE_MAJOR): Bump major number, now 6.
(LIBHOGWEED_MAJOR): Bump major number, now 5.
From Nikos Mavrogiannopoulos. Support for versioned symbols.
* aclocal.m4 (LD_VERSION_SCRIPT): New macro. Substitute
EXTRA_LINKER_FLAGS and EXTRA_HOGWEED_LINKER_FLAGS.
* configure.ac: Use LD_VERSION_SCRIPT. Generate libnettle.map
and libhogweed.map.
(HOGWEED_EXTRA_SYMBOLS): New substituted variable.
* libnettle.map.in: New file, libnettle.so linker script
* libhogweed.map.in: New file, libhogweed.so linker script.
* Makefile.in ($(LIBNETTLE_FORLINK)): Use EXTRA_LINKER_FLAGS.
($(LIBHOGWEED_FORLINK)): Use EXTRA_HOGWEED_LINKER_FLAGS.
2014-11-24 Niels Möller <nisse@lysator.liu.se>
* gcm.h (GCM_SET_KEY): Rename macro argument KEY to avoid
......
......@@ -250,7 +250,7 @@ libhogweed.a: $(hogweed_OBJS)
# Rules building shared libraries.
$(LIBNETTLE_FORLINK): $(nettle_OBJS)
$(LIBNETTLE_LINK) $(nettle_OBJS) -o $@ $(LIBNETTLE_LIBS)
$(LIBNETTLE_LINK) $(nettle_OBJS) @EXTRA_LINKER_FLAGS@ -o $@ $(LIBNETTLE_LIBS)
-mkdir .lib 2>/dev/null
(cd .lib \
&& rm -f $(LIBNETTLE_FORLINK) \
......@@ -261,7 +261,7 @@ $(LIBNETTLE_FORLINK): $(nettle_OBJS)
echo nettle > libnettle.stamp
$(LIBHOGWEED_FORLINK): $(hogweed_OBJS) $(LIBNETTLE_FORLINK)
$(LIBHOGWEED_LINK) $(hogweed_OBJS) -o $@ $(LIBHOGWEED_LIBS)
$(LIBHOGWEED_LINK) $(hogweed_OBJS) @EXTRA_HOGWEED_LINKER_FLAGS@ -o $@ $(LIBHOGWEED_LIBS)
-mkdir .lib 2>/dev/null
(cd .lib \
&& rm -f $(LIBHOGWEED_FORLINK) \
......
......@@ -1246,3 +1246,62 @@ ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
ac_cv_type_intmax_t="$ac_cv_type_intmax_t"
])
])
# ld-version-script.m4 serial 3
dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Simon Josefsson
# FIXME: The test below returns a false positive for mingw
# cross-compiles, 'local:' statements does not reduce number of
# exported symbols in a DLL. Use --disable-ld-version-script to work
# around the problem.
# gl_LD_VERSION_SCRIPT
# --------------------
# Check if LD supports linker scripts, and define automake conditional
# HAVE_LD_VERSION_SCRIPT if so.
AC_DEFUN([LD_VERSION_SCRIPT],
[
AC_ARG_ENABLE([ld-version-script],
AS_HELP_STRING([--enable-ld-version-script],
[enable linker version script (default is enabled when possible)]),
[have_ld_version_script=$enableval], [])
if test -z "$have_ld_version_script"; then
AC_MSG_CHECKING([if LD -Wl,--version-script works])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
cat > conftest.map <<EOF
foo
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[accepts_syntax_errors=yes], [accepts_syntax_errors=no])
if test "$accepts_syntax_errors" = no; then
cat > conftest.map <<EOF
VERS_1 {
global: sym;
};
VERS_2 {
global: sym;
} VERS_1;
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[have_ld_version_script=yes], [have_ld_version_script=no])
else
have_ld_version_script=no
fi
rm -f conftest.map
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT($have_ld_version_script)
fi
if test "$have_ld_version_script" = "yes";then
EXTRA_LINKER_FLAGS="-Wl,--version-script=libnettle.map"
AC_SUBST(EXTRA_LINKER_FLAGS)
EXTRA_HOGWEED_LINKER_FLAGS="-Wl,--version-script=libhogweed.map"
AC_SUBST(EXTRA_HOGWEED_LINKER_FLAGS)
fi
])
......@@ -10,10 +10,10 @@ AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADER([config.h])
LIBNETTLE_MAJOR=5
LIBNETTLE_MAJOR=6
LIBNETTLE_MINOR=0
LIBHOGWEED_MAJOR=4
LIBHOGWEED_MAJOR=5
LIBHOGWEED_MINOR=0
AC_CANONICAL_HOST
......@@ -85,10 +85,13 @@ AC_ARG_ENABLE(mini-gmp,
if test "x$enable_mini_gmp" = xyes ; then
NETTLE_USE_MINI_GMP=1
HOGWEED_EXTRA_SYMBOLS="mpz_*;gmp_*;mpn_*;"
else
NETTLE_USE_MINI_GMP=0
HOGWEED_EXTRA_SYMBOLS=""
fi
AC_SUBST([NETTLE_USE_MINI_GMP])
AC_SUBST([HOGWEED_EXTRA_SYMBOLS])
LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \
`echo $exec_prefix | sed "s@^NONE@$prefix/lib@g" | sed "s@^NONE@$ac_default_prefix/lib@g"` \
......@@ -123,6 +126,8 @@ AC_TRY_COMPILE([],[return 0;],[IF_CXX=''], [IF_CXX='#'])
AC_SUBST([IF_CXX])
AC_LANG_POP
LD_VERSION_SCRIPT
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_CHECK_TOOL(NM, nm, strings)
......@@ -892,7 +897,7 @@ fi
AC_CONFIG_FILES([config.make config.m4 Makefile bignum.h])
AC_CONFIG_FILES([tools/Makefile testsuite/Makefile examples/Makefile])
AC_CONFIG_FILES([nettle.pc hogweed.pc])
AC_CONFIG_FILES([nettle.pc hogweed.pc libnettle.map libhogweed.map])
AC_OUTPUT
......
# libhogweed.map -- libhogweed linker version script. -*- ld-script -*-
#
# The symbol version must be updated on every hogweed
# library major number change. That is taken care by
# auto-generating the file.
HOGWEED_@LIBHOGWEED_MAJOR@
{
global:
nettle_*;
_nettle_*;
@HOGWEED_EXTRA_SYMBOLS@
local:
*;
};
# libnettle.map -- libnettle linker version script. -*- ld-script -*-
#
# The symbol version must be updated on every nettle
# library major number change. That is taken care by
# auto-generating the file.
NETTLE_@LIBNETTLE_MAJOR@
{
global:
nettle_*;
_nettle_*;
local:
*;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment