Don't use -Wl,--no-undefined with the sanitizers/fuzzers.

It breaks linking when using -fsanitize with clang at least.
This commit is contained in:
Todd C. Miller
2023-01-19 19:40:35 -07:00
parent c6cc680069
commit 7a64275a3d
2 changed files with 36 additions and 30 deletions

33
configure vendored
View File

@@ -19824,21 +19824,23 @@ fi
# #
# Don't allow undefined symbols, even in shared libraries, if possible. # Don't allow undefined symbols, even in shared libraries, if possible.
# This will detect missing symbols at build-time instead of run-time. # This will detect missing symbols at build-time instead of run-time
# but is incompatible with the sanitizers/fuzzers.
# We must set this *before* the library tests. # We must set this *before* the library tests.
# #
case "$host_os" in if test X"${enable_sanitizer}{enable_fuzzer}" = X"nono"; then
freebsd*|dragonfly*|openbsd*) case "$host_os" in
# On FreeBSD and Dragonfly, environ is filled in by the freebsd*|dragonfly*|openbsd*)
# dynamic loader so we cannot use -Wl,--no-undefined. # On FreeBSD and Dragonfly, environ is filled in by the
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265 # dynamic loader so we cannot use -Wl,--no-undefined.
# OpenBSD shared libraries don't link explicitly with libc # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265
# which results in undefined references errors. # OpenBSD shared libraries don't link explicitly with libc
# Ideally we would link a shared object with -Wl,--no-undefined # which results in undefined references errors.
# and see if it works but this is not easy in a libtool world. # Ideally we would link a shared object with -Wl,--no-undefined
;; # and see if it works but this is not easy in a libtool world.
*) ;;
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,--no-undefined" >&5 *)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,--no-undefined" >&5
printf %s "checking whether the linker accepts -Wl,--no-undefined... " >&6; } printf %s "checking whether the linker accepts -Wl,--no-undefined... " >&6; }
if test ${ax_cv_check_ldflags___Wl___no_undefined+y} if test ${ax_cv_check_ldflags___Wl___no_undefined+y}
then : then :
@@ -19913,8 +19915,9 @@ else case e in #(
esac esac
fi fi
;; ;;
esac esac
fi
# #
# HP-UX may need to define _XOPEN_SOURCE_EXTENDED to expose MSG_WAITALL. # HP-UX may need to define _XOPEN_SOURCE_EXTENDED to expose MSG_WAITALL.

View File

@@ -2451,23 +2451,26 @@ AC_SYS_YEAR2038
# #
# Don't allow undefined symbols, even in shared libraries, if possible. # Don't allow undefined symbols, even in shared libraries, if possible.
# This will detect missing symbols at build-time instead of run-time. # This will detect missing symbols at build-time instead of run-time
# but is incompatible with the sanitizers/fuzzers.
# We must set this *before* the library tests. # We must set this *before* the library tests.
# #
case "$host_os" in if test X"${enable_sanitizer}{enable_fuzzer}" = X"nono"; then
freebsd*|dragonfly*|openbsd*) case "$host_os" in
# On FreeBSD and Dragonfly, environ is filled in by the freebsd*|dragonfly*|openbsd*)
# dynamic loader so we cannot use -Wl,--no-undefined. # On FreeBSD and Dragonfly, environ is filled in by the
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265 # dynamic loader so we cannot use -Wl,--no-undefined.
# OpenBSD shared libraries don't link explicitly with libc # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265
# which results in undefined references errors. # OpenBSD shared libraries don't link explicitly with libc
# Ideally we would link a shared object with -Wl,--no-undefined # which results in undefined references errors.
# and see if it works but this is not easy in a libtool world. # Ideally we would link a shared object with -Wl,--no-undefined
;; # and see if it works but this is not easy in a libtool world.
*) ;;
AX_CHECK_LINK_FLAG([-Wl,--no-undefined], [AX_APPEND_FLAG([-Wl,--no-undefined], [LDFLAGS])]) *)
;; AX_CHECK_LINK_FLAG([-Wl,--no-undefined], [AX_APPEND_FLAG([-Wl,--no-undefined], [LDFLAGS])])
esac ;;
esac
fi
# #
# HP-UX may need to define _XOPEN_SOURCE_EXTENDED to expose MSG_WAITALL. # HP-UX may need to define _XOPEN_SOURCE_EXTENDED to expose MSG_WAITALL.