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

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 28 09:12:37 CDT 2016


Module: wine
Branch: master
Commit: e59395208d527d1bffb2725efc85fb798aee7610
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e59395208d527d1bffb2725efc85fb798aee7610

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar 28 15:47:19 2016 +0900

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 at winehq.org>

---

 configure               | 25 +++++++++++++++++++++++++
 configure.ac            |  2 ++
 tools/winegcc/winegcc.c |  2 ++
 3 files changed, 29 insertions(+)

diff --git a/configure b/configure
index 189198b..5d99f47 100755
--- a/configure
+++ b/configure
@@ -8652,6 +8652,31 @@ fi
                                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 a659b80..dd7571d 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 8b69053..1ddafc6 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




More information about the wine-cvs mailing list