diff options
author | Björn Jacke <bj@sernet.de> | 2009-10-20 01:13:56 +0200 |
---|---|---|
committer | Björn Jacke <bj@sernet.de> | 2009-10-20 10:52:06 +0200 |
commit | f96f8f9c7720de8f032f571e81246c59e13550c1 (patch) | |
tree | d8f0761dcd87dc405016bae8d702d16e3f8a4630 /source3 | |
parent | 438f400680a5952ef419e4045d85076b8f723f0f (diff) | |
download | samba-f96f8f9c7720de8f032f571e81246c59e13550c1.tar.gz samba-f96f8f9c7720de8f032f571e81246c59e13550c1.tar.bz2 samba-f96f8f9c7720de8f032f571e81246c59e13550c1.zip |
s3: make unresolved symbols in libs throw errors
except for the Samba internal plugins unresolved symbol references should not
show up in shared libraries. For historical reasons it's the default behaviour
of linkers to ignore those in shared libs. We use -z defs (alias
--no-undefined) to not ignore them in shared libs.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 6 | ||||
-rw-r--r-- | source3/configure.in | 30 |
2 files changed, 30 insertions, 6 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 399d01f793..6ce47695df 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -45,11 +45,11 @@ CPPFLAGS=-DHAVE_CONFIG_H @CPPFLAGS@ EXEEXT=@EXEEXT@ AR=@AR@ -LDSHFLAGS=@LDSHFLAGS@ @RELRO_LDFLAGS@ @LDFLAGS@ -LDPLUGINFLAGS=@LDSHFLAGS@ @RELRO_LDFLAGS@ @LDFLAGS@ +LDSHFLAGS=@LDSHFLAGS@ @RELRO_LDFLAGS@ @LDFLAGS@ @LDSHFLAGS_Z_DEFS@ +LDPLUGINFLAGS=@LDSHFLAGS@ @RELRO_LDFLAGS@ @LDFLAGS@ @LDSHFLAGS_Z_NODEFS@ LDFLAGS=@PIE_LDFLAGS@ @RELRO_LDFLAGS@ @LDFLAGS@ -WINBIND_NSS_LDSHFLAGS=@WINBIND_NSS_LDSHFLAGS@ @LDFLAGS@ +WINBIND_NSS_LDSHFLAGS=@WINBIND_NSS_LDSHFLAGS@ @LDFLAGS@ @LDSHFLAGS_Z_DEFS@ AWK=@AWK@ PICFLAG=@PICFLAG@ DYNEXP=@DYNEXP@ diff --git a/source3/configure.in b/source3/configure.in index 69596df46c..80a347cd4e 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -377,6 +377,10 @@ esac DYNEXP= AC_SUBST(DYNEXP) +LDSHFLAGS_Z_DEFS= +AC_SUBST(LDSHFLAGS_Z_DEFS) +LDSHFLAGS_Z_NODEFS= +AC_SUBST(LDSHFLAGS_Z_NODEFS) dnl Add modules that have to be built by default here dnl These have to be built static: @@ -1557,10 +1561,9 @@ DSO_EXPORTS="" AC_DEFINE(LINUX,1,[Whether the host os is linux]) ;; esac BLDSHARED="true" + LDSHFLAGS="-shared -Wl,-Bsymbolic" if test "${ac_cv_gnu_ld_no_default_allow_shlib_undefined}" = "yes"; then - LDSHFLAGS="-shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined" - else - LDSHFLAGS="-shared -Wl,-Bsymbolic" + LDSHFLAGS_Z_NODEFS="-Wl,--allow-shlib-undefined" fi DYNEXP="-Wl,--export-dynamic" PICFLAG="-fPIC" @@ -1772,6 +1775,27 @@ if test x"${ac_cv_prog_gnu_ld}" = x"yes"; then LDFLAGS="$LD_AS_NEEDED_FLAG $saved_ldflags" fi +# for historical reasons almost all linkers don't complain about unresolved +# symbols in shared libs. Except for the internal samba modules we want to get +# errors when we produce a shared lib with unresolved symbols. On some +# platforms unresolved symbols might be intended, so we might have to add +# platform specific exceptions here. + +for flags in "-Wl,-z,defs" "-error_unresolved" "-Wl,-error_unresolved" ; do + saved_ldflags="$LDFLAGS" + AC_MSG_CHECKING([if $flags works]) + LDFLAGS="$flags $saved_ldflags" + AC_TRY_LINK([],[], + [AC_MSG_RESULT([yes]) + LDSHFLAGS_Z_DEFS=$flags + ldshflags_z_defs_found=yes], + AC_MSG_RESULT([no])) + LDFLAGS=$saved_ldflags + test x"$ldshflags_z_defs_found" = xyes && break +done + +AC_MSG_CHECKING([LDSHFLAGS_Z_DEFS]) +AC_MSG_RESULT([$LDSHFLAGS_Z_DEFS]) AC_MSG_CHECKING([LDFLAGS]) AC_MSG_RESULT([$LDFLAGS]) AC_MSG_CHECKING([DYNEXP]) |