summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-05-23 11:52:31 +0200
committerStefan Metzmacher <metze@samba.org>2008-05-23 17:19:57 +0200
commit7abda3fb9d10ec5c8b2f61508cd1362d324e3a8a (patch)
treee5f177f3e0e25ebed8e4726b3b49d56da817662d
parent3d6911afca4c3412b71ba2aeb75abc71cabf74df (diff)
downloadsamba-7abda3fb9d10ec5c8b2f61508cd1362d324e3a8a.tar.gz
samba-7abda3fb9d10ec5c8b2f61508cd1362d324e3a8a.tar.bz2
samba-7abda3fb9d10ec5c8b2f61508cd1362d324e3a8a.zip
build: add symbol versioning when we build with gnu ld
There's --enable-symbol-versioning=no to disable it. metze (cherry picked from commit cb5492978b6b157f529806afb2f5fc6202888129) (This used to be commit a739652d94300881479262648592223536fc8eec)
-rw-r--r--source3/Makefile.in16
-rw-r--r--source3/configure.in17
-rw-r--r--source3/exports/libsmbclient.version.syms8
-rw-r--r--source3/exports/libsmbsharemodes.version.syms7
-rw-r--r--source3/script/mksyms.awk3
-rwxr-xr-xsource3/script/mksyms.sh34
6 files changed, 69 insertions, 16 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index f5f11154ee..f9d0753bb6 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1613,8 +1613,8 @@ bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIB
MKSYMS_SH = $(srcdir)/script/mksyms.sh
-$(LIBTALLOC_SYMS): $(LIBTALLOC_HEADERS)
- @$(MKSYMS_SH) $(AWK) $@ $(LIBTALLOC_HEADERS)
+$(LIBTALLOC_SYMS): $(LIBTALLOC_HEADERS) $(builddir)/library-versions
+ @$(MKSYMS_SH) $(AWK) $(builddir)/library-versions $@ $(LIBTALLOC_HEADERS)
$(LIBTALLOC_SHARED_TARGET): $(BINARY_PREREQS) $(LIBTALLOC_OBJ) $(LIBTALLOC_SYMS)
@echo Linking shared library $@
@@ -1626,8 +1626,8 @@ $(LIBTALLOC_STATIC_TARGET): $(BINARY_PREREQS) $(LIBTALLOC_OBJ0)
@echo Linking non-shared library $@
@-$(AR) -rc $@ $(LIBTALLOC_OBJ0)
-$(LIBTDB_SYMS): $(LIBTDB_HEADERS)
- @$(MKSYMS_SH) $(AWK) $@ $(LIBTDB_HEADERS)
+$(LIBTDB_SYMS): $(LIBTDB_HEADERS) $(builddir)/library-versions
+ @$(MKSYMS_SH) $(AWK) $(builddir)/library-versions $@ $(LIBTDB_HEADERS)
$(LIBTDB_SHARED_TARGET): $(BINARY_PREREQS) $(LIBTDB_OBJ) $(LIBTDB_SYMS)
@echo Linking shared library $@
@@ -1639,8 +1639,8 @@ $(LIBTDB_STATIC_TARGET): $(BINARY_PREREQS) $(LIBTDB_OBJ0)
@echo Linking non-shared library $@
@-$(AR) -rc $@ $(LIBTDB_OBJ0)
-$(LIBWBCLIENT_SYMS): $(LIBWBCLIENT_HEADERS)
- @$(MKSYMS_SH) $(AWK) $@ $(LIBWBCLIENT_HEADERS)
+$(LIBWBCLIENT_SYMS): $(LIBWBCLIENT_HEADERS) $(builddir)/library-versions
+ @$(MKSYMS_SH) $(AWK) $(builddir)/library-versions $@ $(LIBWBCLIENT_HEADERS)
$(LIBWBCLIENT_SHARED_TARGET): $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) $(LIBWBCLIENT_SYMS) @LIBTALLOC_SHARED@
@echo Linking shared library $@
@@ -1662,8 +1662,8 @@ bin/libaddns.a: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
@echo Linking non-shared library $@
@-$(AR) -rc $@ $(LIBADDNS_OBJ)
-$(LIBNETAPI_SYMS): $(LIBNETAPI_HEADERS)
- @$(MKSYMS_SH) $(AWK) $@ $(LIBNETAPI_HEADERS)
+$(LIBNETAPI_SYMS): $(LIBNETAPI_HEADERS) $(builddir)/library-versions
+ @$(MKSYMS_SH) $(AWK) $(builddir)/library-versions $@ $(LIBNETAPI_HEADERS)
$(LIBNETAPI_SHARED_TARGET): $(BINARY_PREREQS) $(LIBNETAPI_OBJ) $(LIBNETAPI_SYMS) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking shared library $@
diff --git a/source3/configure.in b/source3/configure.in
index 451de89035..f077908e61 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1505,6 +1505,23 @@ fi
# Set defaults
SYMSEXT="syms"
AC_SUBST(SYMSEXT)
+use_symbol_versioning=no
+if test x"$ac_cv_gnu_ld_version_script" = x"yes"; then
+ use_symbol_versioning=yes
+fi
+AC_ARG_ENABLE(symbol-versioning,[
+ AS_HELP_STRING([--enable-symbol-versioning],
+ [Turn on symbol versioning support if available (default=auto)])
+])
+if test x"$enable_symbol_versioning" = x"no"; then
+ use_symbol_versioning=no
+fi
+
+AC_MSG_CHECKING([symbol versioning])
+if test "x$use_symbol_versioning" = x"yes"; then
+ SYMSEXT="version.syms"
+fi
+AC_MSG_RESULT($use_symbol_versioning)
# Assume non-shared by default and override below
BLDSHARED="false"
diff --git a/source3/exports/libsmbclient.version.syms b/source3/exports/libsmbclient.version.syms
new file mode 100644
index 0000000000..6afdbcbadf
--- /dev/null
+++ b/source3/exports/libsmbclient.version.syms
@@ -0,0 +1,8 @@
+#
+# we use no version symbols for libsmbclient
+# to be compatible with 3.0.x
+#
+{
+ global: smbc_*;
+ local: *;
+};
diff --git a/source3/exports/libsmbsharemodes.version.syms b/source3/exports/libsmbsharemodes.version.syms
new file mode 100644
index 0000000000..cf3f0336e9
--- /dev/null
+++ b/source3/exports/libsmbsharemodes.version.syms
@@ -0,0 +1,7 @@
+#
+# we use no version symbols for libsmbsharemodes
+# to be compatible with 3.0.x
+#
+{
+ global: *;
+};
diff --git a/source3/script/mksyms.awk b/source3/script/mksyms.awk
index a30bea4d34..dfe51dba7f 100644
--- a/source3/script/mksyms.awk
+++ b/source3/script/mksyms.awk
@@ -9,9 +9,6 @@
BEGIN {
inheader=0;
current_file="";
- print "#"
- print "# This file is automatically generated with \"make symbols\". DO NOT EDIT "
- print "#"
print "{"
print "\tglobal:"
}
diff --git a/source3/script/mksyms.sh b/source3/script/mksyms.sh
index 51d3fbd999..673c77a3cf 100755
--- a/source3/script/mksyms.sh
+++ b/source3/script/mksyms.sh
@@ -15,26 +15,50 @@ LANG=C; export LANG
LC_ALL=C; export LC_ALL
LC_COLLATE=C; export LC_COLLATE
-if [ $# -lt 2 ]
+if [ $# -lt 3 ]
then
- echo "Usage: $0 awk output_file header_files"
+ echo "Usage: $0 awk versionfile output_file header_files"
exit 1
fi
awk="$1"
shift
+versionfile="$1"
+shift
+
symsfile="$1"
shift
symsfile_tmp="$symsfile.$$.tmp~"
-proto_src="`echo $@ | tr ' ' '\n' | sort | uniq `"
+libname=`basename $symsfile | cut -d '.' -f1`
+verline=`grep $libname $versionfile`
+majver=`echo -n "$verline" | cut -d ':' -f2`
+minver=`echo -n "$verline" | cut -d ':' -f3`
+upname=`echo -n "$libname" | sed -e 's/^lib//' | tr '[a-z]' '[A-Z]'`
+symver="${upname}_${majver}.${minver}"
-echo creating $symsfile
+symsext=`basename $symsfile | cut -d '.' -f2-`
+
+if test x"$symsext" = x"version.syms"; then
+ echo "creating $symsfile for $symver"
+else
+ echo "creating $symsfile"
+ symver="# no symbol versioning"
+fi
+
+proto_src="`echo $@ | tr ' ' '\n' | sort | uniq `"
mkdir -p `dirname $symsfile`
-${awk} -f `dirname $0`/mksyms.awk $proto_src > $symsfile_tmp
+cat > $symsfile_tmp <<_ACEOF
+#
+# This file is automatically generated with "$0". DO NOT EDIT
+#
+$symver
+_ACEOF
+
+${awk} -f `dirname $0`/mksyms.awk $proto_src >> $symsfile_tmp
if cmp -s $symsfile $symsfile_tmp 2>/dev/null
then