Fixed bug 4308 - Prebuilt SDL.dll files not compiled with ASLR support (DYNAMICBASE)

Cameron Gutman

The current SDL 2.0.8 and the prerelease SDL 2.0.9 are compiled without the DYNAMICBASE flag to indicate that ASLR may relocate the DLL at load-time. https://docs.microsoft.com/en-us/cpp/build/reference/dynamicbase-use-address-space-layout-randomization?view=vs-2017

When I build SDL.dll myself using the VS2010 project, the DLL has the DYNAMICBASE flag set (as is the default). Similarly, MinGW-w64 also enables ASLR by default on all binaries for a couple years now (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836365)
This commit is contained in:
Sam Lantinga 2018-11-02 18:07:11 -07:00
parent cc39c7a0cb
commit 4026f89d19
2 changed files with 153 additions and 0 deletions

102
configure vendored
View File

@ -16063,6 +16063,108 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_no_undefined" >&5
$as_echo "$have_no_undefined" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --dynamicbase" >&5
$as_echo_n "checking for linker option --dynamicbase... " >&6; }
have_dynamicbase=no
case "$host" in
*)
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--dynamicbase"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_dynamicbase=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--dynamicbase"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dynamicbase" >&5
$as_echo "$have_dynamicbase" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --nxcompat" >&5
$as_echo_n "checking for linker option --nxcompat... " >&6; }
have_nxcompat=no
case "$host" in
*)
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--nxcompat"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_nxcompat=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--nxcompat"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_nxcompat" >&5
$as_echo "$have_nxcompat" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --high-entropy-va" >&5
$as_echo_n "checking for linker option --high-entropy-va... " >&6; }
have_high_entropy_va=no
case "$host" in
*)
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--high-entropy-va"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_high_entropy_va=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--high-entropy-va"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_high_entropy_va" >&5
$as_echo "$have_high_entropy_va" >&6; }
# Check whether --enable-libc was given.
if test "${enable_libc+set}" = set; then :
enableval=$enable_libc;

View File

@ -232,6 +232,57 @@ case "$host" in
esac
AC_MSG_RESULT($have_no_undefined)
AC_MSG_CHECKING(for linker option --dynamicbase)
have_dynamicbase=no
case "$host" in
*)
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--dynamicbase"
AC_TRY_LINK([
],[
],[
have_dynamicbase=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--dynamicbase"
])
LDFLAGS="$save_LDFLAGS"
;;
esac
AC_MSG_RESULT($have_dynamicbase)
AC_MSG_CHECKING(for linker option --nxcompat)
have_nxcompat=no
case "$host" in
*)
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--nxcompat"
AC_TRY_LINK([
],[
],[
have_nxcompat=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--nxcompat"
])
LDFLAGS="$save_LDFLAGS"
;;
esac
AC_MSG_RESULT($have_nxcompat)
AC_MSG_CHECKING(for linker option --high-entropy-va)
have_high_entropy_va=no
case "$host" in
*)
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--high-entropy-va"
AC_TRY_LINK([
],[
],[
have_high_entropy_va=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--high-entropy-va"
])
LDFLAGS="$save_LDFLAGS"
;;
esac
AC_MSG_RESULT($have_high_entropy_va)
dnl See whether we are allowed to use the system C library
AC_ARG_ENABLE(libc,
AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),