Skip to content
Permalink
Browse files
Fixed bug 4308 - Prebuilt SDL.dll files not compiled with ASLR suppor…
…t (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)
  • Loading branch information
slouken committed Nov 3, 2018
1 parent cc39c7a commit 4026f89d19394ea6819fd263ebd81425ae8247bb
Showing with 153 additions and 0 deletions.
  1. +102 −0 configure
  2. +51 −0 configure.in
102 configure
@@ -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;
@@ -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]]]),

0 comments on commit 4026f89

Please sign in to comment.