1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Bug 20918 - Building with --enable-nss-crypt fails tst-linkall-static

Some configurations may use NSS cryptographic routines but have no
static library for those routines. The following changes allow glibc to
be built and tested with --enable-nss-crypt, but without having a static
NSS library. At a high level the change does two things:

(1) Detect at configure time if static NSS crypto libraries are
    available.  Assumes libfreebl3.a (instead of the existing Fedora
    libfreebl.a which is incomplete) which matches libfreebl3.so.

(2) If static NSS crypto libraries are _not_ available then adjust the
    way in which we build tst-linkall-static. This includes excluding a
    reference to crypt and not linking against libcrypt.a, all of which
    will fail otherwise.

Testing assumptions:
* Static library is named libfreebl3.a (not libfreebl.a as is currently
  provided in Fedora), matching libfreebl3.so shared link name.

Tested on x86_64 on Fedora with:

(a) --enable-nss-crypt, with no static NSS library support: PASS
    (previous FAIL)

(b) --enable-nss-crypt, with faked static NSS library support: PASS
    (unsupported)
	* Requires changing elf/Makefile to include a stub
	  /lib64/libfreebl3.a for testing purposes.

(c) --disable-nss-crypt: PASS
    (default)

No regressions on x86_64.

For details see:
https://www.sourceware.org/ml/libc-alpha/2016-11/msg00647.html
This commit is contained in:
Carlos O'Donell
2016-12-02 15:39:09 -05:00
parent 01b23a30b4
commit 84aa75162c
6 changed files with 92 additions and 2 deletions

29
configure vendored
View File

@ -665,6 +665,7 @@ add_ons
build_pt_chown
build_nscd
link_obsolete_rpc
libc_cv_static_nss_crypt
libc_cv_nss_crypt
enable_werror
all_warnings
@ -3529,6 +3530,7 @@ cannot find NSS headers with lowlevel hash function interfaces" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
old_LIBS="$LIBS"
old_LDFLAGS="$LDFLAGS"
LIBS="$LIBS -lfreebl3"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@ -3551,14 +3553,41 @@ cannot link program using lowlevel NSS hash functions" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
# Check to see if there is a static NSS cryptographic library.
# If there isn't then we can't link anything with libcrypt.a,
# and that might mean disabling some static tests.
LDFLAGS="$LDFLAGS -static"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
typedef int PRBool;
#include <hasht.h>
#include <nsslowhash.h>
int
main ()
{
NSSLOW_Init();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
libc_cv_static_nss_crypt=yes
else
libc_cv_static_nss_crypt=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$old_LDFLAGS"
CFLAGS="$old_CFLAGS"
LIBS="$old_LIBS"
else
libc_cv_nss_crypt=no
libc_cv_static_nss_crypt=no
fi
# Check whether --enable-obsolete-rpc was given.
if test "${enable_obsolete_rpc+set}" = set; then :
enableval=$enable_obsolete_rpc; link_obsolete_rpc=$enableval