[PATCH] kernel32: force 4096 byte page alignment

Gerald Pfeifer gerald at pfeifer.com
Thu Nov 12 12:58:37 CST 2020


FreeBSD prefers to use a 0x200000 (super) page alignment. This causes 
the image base to be displaced from the requested location. Forcing a 
smaller page size ensures the image can be placed there.

This should not have negative impact on other, e.g. Linux-based, 
platforms I believe.

The patch was originally contributed to the FreeBSD emulators/wine(-devel) 
port by David Naylor in February 2015. We have carried it as part of those 
two ever since, with occasional adjustments of mine. I am now submitting 
this here with David's consent.


Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
Signed-off-by: David Naylor <naylor.b.david at gmail.com>, 
---
 dlls/kernel32/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in
index 832f2365b15..f932f83c6b6 100644
--- a/dlls/kernel32/Makefile.in
+++ b/dlls/kernel32/Makefile.in
@@ -2,7 +2,7 @@ EXTRADEFS = -D_KERNEL32_ -D_NORMALIZE_
 MODULE    = kernel32.dll
 IMPORTLIB = kernel32
 IMPORTS   = kernelbase ntdll winecrt0
-EXTRADLLFLAGS = -mno-cygwin -nodefaultlibs -Wb,-F,KERNEL32.dll -Wl,--image-base,0x7b600000
+EXTRADLLFLAGS = -mno-cygwin -nodefaultlibs -Wb,-F,KERNEL32.dll -Wl,--image-base,0x7b600000 -Wl,-z,max-page-size=0x1000
 
 C_SRCS = \
 	atom.c \
-- 
2.28.0



More information about the wine-devel mailing list