diff --git a/configure b/configure index 189198bcc3f..5d99f474b37 100755 --- a/configure +++ b/configure @@ -8651,6 +8651,31 @@ fi then as_fn_append wine_warnings "|prelink not found and linker does not support relocation, base address of core dlls won't be set correctly." fi +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-z,max-page-size=0x1000" >&5 +$as_echo_n "checking whether the compiler supports -Wl,-z,max-page-size=0x1000... " >&6; } +if ${ac_cv_cflags__Wl__z_max_page_size_0x1000+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_wine_try_cflags_saved=$CFLAGS +CFLAGS="$CFLAGS -Wl,-z,max-page-size=0x1000" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(int argc, char **argv) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_cflags__Wl__z_max_page_size_0x1000=yes +else + ac_cv_cflags__Wl__z_max_page_size_0x1000=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +CFLAGS=$ac_wine_try_cflags_saved +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__z_max_page_size_0x1000" >&5 +$as_echo "$ac_cv_cflags__Wl__z_max_page_size_0x1000" >&6; } +if test "x$ac_cv_cflags__Wl__z_max_page_size_0x1000" = xyes; then : + LDEXECFLAGS="$LDEXECFLAGS -Wl,-z,max-page-size=0x1000" fi ;; esac diff --git a/configure.ac b/configure.ac index a659b80dfe8..dd7571de99d 100644 --- a/configure.ac +++ b/configure.ac @@ -910,6 +910,8 @@ case $host_os in then WINE_WARNING([prelink not found and linker does not support relocation, base address of core dlls won't be set correctly.]) fi]) + WINE_TRY_CFLAGS([-Wl,-z,max-page-size=0x1000], + [LDEXECFLAGS="$LDEXECFLAGS -Wl,-z,max-page-size=0x1000"]) ;; esac diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 8b69053c26d..1ddafc61bfb 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -1135,6 +1135,8 @@ static void build(struct options* opts) default: if (opts->image_base) { + if (!try_link(opts->prefix, link_args, "-Wl,-z,max-page-size=0x1000")) + strarray_add(link_args, "-Wl,-z,max-page-size=0x1000"); if (!try_link(opts->prefix, link_args, strmake("-Wl,-Ttext-segment=%s", opts->image_base))) strarray_add(link_args, strmake("-Wl,-Ttext-segment=%s", opts->image_base)); else