makefiles: Reduce the maximum page size for modules that have a base address.

It avoid bumping into the next allocated base address on 64-bit.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-03-28 15:47:19 +09:00
parent 36cf292048
commit e59395208d
3 changed files with 29 additions and 0 deletions

25
configure vendored
View File

@ -8651,6 +8651,31 @@ fi
then 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." 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
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 fi
;; ;;
esac esac

View File

@ -910,6 +910,8 @@ case $host_os in
then then
WINE_WARNING([prelink not found and linker does not support relocation, base address of core dlls won't be set correctly.]) WINE_WARNING([prelink not found and linker does not support relocation, base address of core dlls won't be set correctly.])
fi]) fi])
WINE_TRY_CFLAGS([-Wl,-z,max-page-size=0x1000],
[LDEXECFLAGS="$LDEXECFLAGS -Wl,-z,max-page-size=0x1000"])
;; ;;
esac esac

View File

@ -1135,6 +1135,8 @@ static void build(struct options* opts)
default: default:
if (opts->image_base) 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))) 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)); strarray_add(link_args, strmake("-Wl,-Ttext-segment=%s", opts->image_base));
else else