summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2007-07-03 19:55:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:46 -0500
commit3a246ac46b9ae2bbc62498092a616b87732ab818 (patch)
tree4e7fc8558f19453b5a193def93c585a93c67d8ef /source3
parent6afbd15b673fa9fd307459a61c396c3ea9370158 (diff)
downloadsamba-3a246ac46b9ae2bbc62498092a616b87732ab818.tar.gz
samba-3a246ac46b9ae2bbc62498092a616b87732ab818.tar.bz2
samba-3a246ac46b9ae2bbc62498092a616b87732ab818.zip
r23689: Squashed commit of the following:
commit 0d4bbd197198a94bf4e29e0ccd175a40a60097f3 Author: Gerald (Jerry) Carter <jerry@samba.org> Date: Mon Jul 2 20:08:19 2007 -0500 Introduce GNU ld linker export-script for hiding non-public symbols in shared libraries. Based on initial patch from Julien Cristau <jcristau@debian.org> and suggestions from James Peach <jpeach@samba.org>. Currently the libsmbsharemodes libraries still exports *. Signed off on my Derrell as well. (This used to be commit c42cf731b4b259c5c1a874fd1837ca85144f1a58)
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in33
-rw-r--r--source3/configure.in15
-rw-r--r--source3/exports/libsmbclient.syms4
-rw-r--r--source3/exports/libsmbsharemodes.syms3
-rw-r--r--source3/library-versions.in9
5 files changed, 43 insertions, 21 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 9910f0feb5..bc0fb2b0ff 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -21,6 +21,12 @@ LIBS=@LIBS@
CC=@CC@
SHLD=@SHLD@
+## Dynamic shared libraries build settings
+DSO_EXPORTS_CMD=-Wl,--version-script,exports/`basename $@ | sed 's/@SHLIBEXT@$$/syms/'`
+DSO_EXPORTS=@DSO_EXPORTS@
+SONAME_VER=`grep ^$@ $(srcdir)/library-versions | cut -d: -f2`
+SHLD_DSO = $(SHLD) $(LDSHFLAGS) $(DSO_EXPORTS)
+
# Add $(DEVELOPER_CFLAGS) to $(CFLAGS) to enable extra compiler
# (GCC) warnings. This is done automtically for --enable-developer
# and --enable-krb5developer.
@@ -125,20 +131,9 @@ LOCKDIR = @lockdir@
PIDDIR = @piddir@
LIBSMBCLIENT=bin/libsmbclient.a @LIBSMBCLIENT_SHARED@
-LIBSMBCLIENT_MAJOR=0
-LIBSMBCLIENT_MINOR=1
-
LIBMSRPC=bin/libmsrpc.a @LIBMSRPC_SHARED@
-LIBMSRPC_MAJOR=0
-LIBMSRPC_MINOR=1
-
LIBSMBSHAREMODES=bin/libsmbsharemodes.a @LIBSMBSHAREMODES_SHARED@
-LIBSMBSHAREMODES_MAJOR=0
-LIBSMBSHAREMODES_MINOR=2
-
LIBADDNS=bin/libaddns.a @LIBADDNS_SHARED@
-LIBADDNS_MAJOR=0
-LIBADDNS_MINOR=1
FLAGS1 = $(CFLAGS) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS)
FLAGS2 =
@@ -1357,9 +1352,9 @@ bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@
bin/libaddns.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
@echo Linking libaddns shared library $@
- @$(SHLD) $(LDSHFLAGS) -o $@ $(LIBADDNS_OBJ) $(LDFLAGS) $(LIBS) \
+ @$(SHLD_DSO) -o $@ $(LIBADDNS_OBJ) $(LDFLAGS) $(LIBS) \
$(KRB5LIBS) $(UUID_LIBS)\
- @SONAMEFLAG@`basename $@`.$(LIBADDNS_MAJOR)
+ @SONAMEFLAG@`basename $@`.$(SONAME_VER)
bin/libaddns.a: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
@echo Linking libaddns non-shared library $@
@@ -1367,9 +1362,9 @@ bin/libaddns.a: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
bin/libsmbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ)
@echo Linking libsmbclient shared library $@
- @$(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBCLIENT_OBJ) $(LDFLAGS) $(LIBS) \
+ @$(SHLD_DSO) -o $@ $(LIBSMBCLIENT_OBJ) $(LDFLAGS) $(LIBS) \
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
- @SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR)
+ @SONAMEFLAG@`basename $@`.$(SONAME_VER)
bin/libsmbclient.a: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ)
@echo Linking libsmbclient non-shared library $@
@@ -1377,9 +1372,9 @@ bin/libsmbclient.a: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ)
bin/libsmbsharemodes.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBSHAREMODES_OBJ)
@echo Linking libsmbsharemodes shared library $@
- @$(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBSHAREMODES_OBJ) $(LDFLAGS) $(LIBS) \
+ @$(SHLD_DSO) -o $@ $(LIBSMBSHAREMODES_OBJ) $(LDFLAGS) $(LIBS) \
$(KRB5LIBS) $(LDAP_LIBS) \
- @SONAMEFLAG@`basename $@`.$(LIBSMBSHAREMODES_MAJOR)
+ @SONAMEFLAG@`basename $@`.$(SONAME_VER)
bin/libsmbsharemodes.a: $(BINARY_PREREQS) $(LIBSMBSHAREMODES_OBJ)
@echo Linking libsmbsharemodes non-shared library $@
@@ -1387,8 +1382,8 @@ bin/libsmbsharemodes.a: $(BINARY_PREREQS) $(LIBSMBSHAREMODES_OBJ)
bin/libmsrpc.@SHLIBEXT@: $(BINARY_PREREQS) $(CAC_OBJ)
@echo Linking libmsrpc shared library $@
- @$(SHLD) $(LDSHFLAGS) -o $@ $(CAC_OBJ) $(LDFLAGS) $(LIBS) \
- @SONAMEFLAG@`basename $@`.$(LIBMSRPC_MAJOR)
+ @$(SHLD_DSO) -o $@ $(CAC_OBJ) $(LDFLAGS) $(LIBS) \
+ @SONAMEFLAG@`basename $@`.$(SONAME_VER)
bin/libmsrpc.a: $(BINARY_PREREQS) $(CAC_OBJ)
@echo Linking libmsrpc non-shared library $@
diff --git a/source3/configure.in b/source3/configure.in
index b37e59c35b..4c718bc6ee 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -283,6 +283,7 @@ AC_SUBST(LDSHFLAGS)
AC_SUBST(MODULE_EXPORTS)
AC_SUBST(SONAMEFLAG)
AC_SUBST(SHLD)
+AC_SUBST(DSO_EXPORTS)
AC_SUBST(HOST_OS)
AC_SUBST(PICFLAG)
AC_SUBST(PIE_CFLAGS)
@@ -545,6 +546,9 @@ if test "$ac_cv_prog_gnu_ld" = "yes"; then
if test "$ac_cv_gnu_ld_date" -lt 20030217; then
ac_cv_gnu_ld_no_default_allow_shlib_undefined=yes
fi
+ if test "$ac_cv_gnu_ld_date" -gt 20030101; then
+ ac_cv_gnu_ld_version_script=yes
+ fi
else
AC_MSG_CHECKING(GNU ld release version)
changequote(,)dnl
@@ -560,6 +564,9 @@ if test "$ac_cv_prog_gnu_ld" = "yes"; then
if test "$ac_cv_gnu_ld_vernr_major" -lt 2 || test "$ac_cv_gnu_ld_vernr_minor" -lt 14; then
ac_cv_gnu_ld_no_default_allow_shlib_undefined=yes
fi
+ if test "$ac_cv_gnu_ld_vernr_major" -gt 2 || test "$ac_cv_gnu_l= d_vernr_major"=2 && test "$ac_cv_gnu_ld_vernr_minor" -ge 12; then
+ ac_cv_gnu_ld_version_script=yes
+ fi
fi
fi
@@ -1839,7 +1846,7 @@ SONAMEFLAG="#"
SHLD="\${CC} \${CFLAGS}"
PICFLAG="${PIE_CFLAGS}"
SHLIBEXT="so"
-
+DSO_EXPORTS=""
# this bit needs to be modified for each OS that supports share libs
# You need to specify how to create a shared library and
@@ -2037,6 +2044,10 @@ if test "$enable_shared" != "yes"; then
BLDSHARED=false
fi
+if test "$enable_shared" = yes -a "${ac_cv_gnu_ld_version_script}" = yes; then
+ DSO_EXPORTS=\$\(DSO_EXPORTS_CMD\)
+fi
+
AC_MSG_RESULT($BLDSHARED)
AC_MSG_CHECKING([LDFLAGS])
@@ -6469,7 +6480,7 @@ AC_SUBST(builddir)
SMBD_LIBS="$samba_dmapi_libs"
AC_SUBST(SMBD_LIBS)
-AC_OUTPUT(Makefile script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh)
+AC_OUTPUT(Makefile library-versions script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh)
#################################################
# Print very concise instructions on building/use
diff --git a/source3/exports/libsmbclient.syms b/source3/exports/libsmbclient.syms
new file mode 100644
index 0000000000..3062e34bfd
--- /dev/null
+++ b/source3/exports/libsmbclient.syms
@@ -0,0 +1,4 @@
+{
+ global: smbc_*;
+ local: *;
+};
diff --git a/source3/exports/libsmbsharemodes.syms b/source3/exports/libsmbsharemodes.syms
new file mode 100644
index 0000000000..eb34bfc012
--- /dev/null
+++ b/source3/exports/libsmbsharemodes.syms
@@ -0,0 +1,3 @@
+{
+ global: *;
+};
diff --git a/source3/library-versions.in b/source3/library-versions.in
new file mode 100644
index 0000000000..3d95675b53
--- /dev/null
+++ b/source3/library-versions.in
@@ -0,0 +1,9 @@
+##
+## Basic script for defining the major and minor librrary revision numbers
+## Makefile_target:major:minor
+##
+bin/libsmbclient.@SHLIBEXT@:0:1
+bin/libsmbsharemodes.@SHLIBEXT@:0:2
+bin/libaddns.@SHLIBEXT@:0:1
+bin/libmsrpc.@SHLIBEXT@:0:1
+