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)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
diff --git a/configure b/configure
index aee0cb6..db15105 100755
--- a/configure
+++ b/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;
diff --git a/configure.in b/configure.in
index ae866ff..91b45d3 100644
--- a/configure.in
+++ b/configure.in
@@ -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]]]),