2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Use --allow-multiple-definition to work around an issue with ld.lld.

For fuzz_policy we redefine getaddrinfo/freeaddrinfo to work around
a DNS timeout problem with name resolution and CIfuzz.  However,
this causes a link failure when sanitizers are enabled on systems
that use ld.lld as their linker.  Use a big hammer to avoid the
link error.
This commit is contained in:
Todd C. Miller 2021-03-18 11:45:41 -06:00
parent 3e5cf7baa3
commit d03805c413
2 changed files with 78 additions and 0 deletions

72
configure vendored
View File

@ -28178,6 +28178,78 @@ fi
;;
esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,--allow-multiple-definition" >&5
printf %s "checking whether the linker accepts -Wl,--allow-multiple-definition... " >&6; }
if test ${ax_cv_check_ldflags___Wl___allow_multiple_definition+y}
then :
printf %s "(cached) " >&6
else $as_nop
ax_check_save_flags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ax_cv_check_ldflags___Wl___allow_multiple_definition=yes
else $as_nop
ax_cv_check_ldflags___Wl___allow_multiple_definition=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$ax_check_save_flags
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___Wl___allow_multiple_definition" >&5
printf "%s\n" "$ax_cv_check_ldflags___Wl___allow_multiple_definition" >&6; }
if test x"$ax_cv_check_ldflags___Wl___allow_multiple_definition" = xyes
then :
if test ${LDFLAGS+y}
then :
case " $LDFLAGS " in #(
*" -Wl,--allow-multiple-definition "*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains -Wl,--allow-multiple-definition"; } >&5
(: LDFLAGS already contains -Wl,--allow-multiple-definition) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } ;; #(
*) :
as_fn_append LDFLAGS " -Wl,--allow-multiple-definition"
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS\""; } >&5
(: LDFLAGS="$LDFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
;;
esac
else $as_nop
LDFLAGS=-Wl,--allow-multiple-definition
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS\""; } >&5
(: LDFLAGS="$LDFLAGS") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
fi
else $as_nop
:
fi
if test -n "$GCC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5
printf %s "checking whether C compiler accepts -fvisibility=hidden... " >&6; }

View File

@ -4456,6 +4456,12 @@ case "$OS" in
;;
esac
dnl
dnl For fuzz_policy we redefine getaddrinfo() and freeaddrinfo(), but
dnl this can cause problems with ld.lld when sanitizers are enabled.
dnl
AX_CHECK_LINK_FLAG([-Wl,--allow-multiple-definition], [AX_APPEND_FLAG([-Wl,--allow-multiple-definition], [LDFLAGS])])
dnl
dnl Check for symbol visibility support.
dnl This test relies on AC_LANG_WERROR