diff --git a/patches/loader-OSX_Preloader/0002-loader-Implement-preloader-for-Mac-OS.patch b/patches/loader-OSX_Preloader/0002-loader-Implement-preloader-for-Mac-OS.patch index 7884dc84..f14420d3 100644 --- a/patches/loader-OSX_Preloader/0002-loader-Implement-preloader-for-Mac-OS.patch +++ b/patches/loader-OSX_Preloader/0002-loader-Implement-preloader-for-Mac-OS.patch @@ -1,20 +1,20 @@ -From 79d2d9e8f181ce3d5f4ba05ae31c4c5ebf4721ed Mon Sep 17 00:00:00 2001 +From 9d3cd3764ad26ae8f190524943ce63a771f6b992 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 12 Jun 2017 00:16:08 +0200 Subject: loader: Implement preloader for Mac OS. --- Makefile.in | 1 + - configure.ac | 30 +++- + configure.ac | 23 ++- dlls/ntdll/virtual.c | 2 - libs/wine/config.c | 2 +- loader/Makefile.in | 4 +- - loader/main.c | 44 ++--- - loader/preloader.c | 449 +++++++++++++++++++++++++++++++++++++++++++++++++-- - 7 files changed, 480 insertions(+), 52 deletions(-) + loader/main.c | 44 +---- + loader/preloader.c | 451 +++++++++++++++++++++++++++++++++++++++++++++++++-- + 7 files changed, 475 insertions(+), 52 deletions(-) diff --git a/Makefile.in b/Makefile.in -index 22b2ae72305..29b6cbdd535 100644 +index 22b2ae7230..29b6cbdd53 100644 --- a/Makefile.in +++ b/Makefile.in @@ -89,6 +89,7 @@ WINELOADER_PROGRAMS = @WINELOADER_PROGRAMS@ @@ -26,7 +26,7 @@ index 22b2ae72305..29b6cbdd535 100644 LIBWINE_IMPORTLIB = @LIBWINE_IMPORTLIB@ LIBWINE_INSTALL_LIB = @LIBWINE_INSTALL_LIB@ diff --git a/configure.ac b/configure.ac -index 0f2221963dc..86c3276d28e 100644 +index 0f2221963d..d9bdf413bb 100644 --- a/configure.ac +++ b/configure.ac @@ -683,6 +683,7 @@ AC_SUBST(LDRPATH_INSTALL,"") @@ -37,7 +37,7 @@ index 0f2221963dc..86c3276d28e 100644 LIBEXT="so" DLLEXT=".so" IMPLIBEXT="def" -@@ -741,9 +742,24 @@ case $host_os in +@@ -741,9 +742,17 @@ case $host_os in AC_SUBST(APPLICATIONSERVICES_LIBS,"-framework ApplicationServices") AC_SUBST(CORESERVICES_LIBS,"-framework CoreServices") AC_SUBST(APPKIT_LIBS,"-framework AppKit") @@ -47,24 +47,17 @@ index 0f2221963dc..86c3276d28e 100644 + WINE_TRY_CFLAGS([-fPIC -Wl,--export-dynamic], + [WINELOADER_LDFLAGS="-Wl,--export-dynamic $WINELOADER_LDFLAGS"]) + -+ WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs -e _start -ldylib1.o -Wl,-image_base,0x7c400000,-sectcreate,__TEXT,__info_plist,wine_info.plist" ++ WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs -e _start -ldylib1.o -Wl,-image_base,0x7c400000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,wine_info.plist" + WINE_TRY_CFLAGS([-Wl,-no_new_main -e _main], + [WINEPRELOADER_LDFLAGS="-Wl,-no_new_main $WINEPRELOADER_LDFLAGS"]) WINE_TRY_CFLAGS([-Wl,-no_pie], - [WINELOADER_LDFLAGS="-Wl,-no_pie $WINELOADER_LDFLAGS"]) + [WINEPRELOADER_LDFLAGS="-Wl,-no_pie $WINEPRELOADER_LDFLAGS"]) -+ -+ case $host_cpu in -+ *i[[3456789]]86*) -+ WINEPRELOADER_LDFLAGS="-Wl,-pagezero_size,0x0 $WINEPRELOADER_LDFLAGS" ;; -+ *x86_64*) -+ WINEPRELOADER_LDFLAGS="-Wl,-pagezero_size,0x1000 $WINEPRELOADER_LDFLAGS" ;; -+ esac + if test "$ac_cv_header_DiskArbitration_DiskArbitration_h" = "yes" then dnl DiskArbitration API is not public on Darwin < 8.0, use it only if header found -@@ -856,6 +872,7 @@ case $host_os in +@@ -856,6 +865,7 @@ case $host_os in enable_wineandroid_drv=${enable_wineandroid_drv:-yes} WINE_TRY_CFLAGS([-fPIC -Wl,--export-dynamic], [WINELOADER_LDFLAGS="-Wl,--export-dynamic"]) @@ -72,7 +65,7 @@ index 0f2221963dc..86c3276d28e 100644 WINE_TRY_CFLAGS([-fPIC -Wl,--rpath,\$ORIGIN/../lib], [LDRPATH_INSTALL="-Wl,--rpath,\\\$\$ORIGIN/\`\$(MAKEDEP) -R \${bindir} \${libdir}\`" LDRPATH_LOCAL="-Wl,--rpath,\\\$\$ORIGIN/\$(top_builddir)/libs/wine"], -@@ -900,6 +917,7 @@ case $host_os in +@@ -900,6 +910,7 @@ case $host_os in WINE_TRY_CFLAGS([-fPIC -Wl,--export-dynamic], [WINELOADER_LDFLAGS="-Wl,--export-dynamic"]) @@ -80,7 +73,7 @@ index 0f2221963dc..86c3276d28e 100644 WINE_TRY_CFLAGS([-fPIC -Wl,--rpath,\$ORIGIN/../lib], [LDRPATH_INSTALL="-Wl,--rpath,\\\$\$ORIGIN/\`\$(MAKEDEP) -R \${bindir} \${libdir}\`:\$(DESTDIR)\${libdir}" -@@ -2009,6 +2027,14 @@ case $host_os in +@@ -2009,6 +2020,14 @@ case $host_os in ;; esac ;; @@ -96,7 +89,7 @@ index 0f2221963dc..86c3276d28e 100644 dnl **** Check for functions **** diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c -index ee9c8d0195d..f115576e1db 100644 +index ee9c8d0195..f115576e1d 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1840,11 +1840,9 @@ void virtual_release_address_space(void) @@ -112,7 +105,7 @@ index ee9c8d0195d..f115576e1db 100644 server_leave_uninterrupted_section( &csVirtual, &sigset ); diff --git a/libs/wine/config.c b/libs/wine/config.c -index be9f401d9e7..bccb36a6c12 100644 +index be9f401d9e..bccb36a6c1 100644 --- a/libs/wine/config.c +++ b/libs/wine/config.c @@ -654,7 +654,7 @@ void wine_exec_wine_binary( const char *name, char **argv, const char *env_var ) @@ -125,7 +118,7 @@ index be9f401d9e7..bccb36a6c12 100644 #else use_preloader = 0; diff --git a/loader/Makefile.in b/loader/Makefile.in -index 4fb91ff5417..b715f022578 100644 +index 4fb91ff541..b715f02257 100644 --- a/loader/Makefile.in +++ b/loader/Makefile.in @@ -26,7 +26,7 @@ wine64_DEPS = $(WINELOADER_DEPENDS) @@ -139,7 +132,7 @@ index 4fb91ff5417..b715f022578 100644 -wine64_preloader_LDFLAGS = -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c400000 +wine64_preloader_LDFLAGS = $(WINEPRELOADER_LDFLAGS) diff --git a/loader/main.c b/loader/main.c -index 13740c7b3c5..5212e3f0798 100644 +index 13740c7b3c..5212e3f079 100644 --- a/loader/main.c +++ b/loader/main.c @@ -50,30 +50,6 @@ @@ -222,7 +215,7 @@ index 13740c7b3c5..5212e3f0798 100644 wine_init( argc, argv, error, sizeof(error) ); diff --git a/loader/preloader.c b/loader/preloader.c -index 5e6add7830f..63cf9eccb12 100644 +index 5e6add7830..5b09b79cf3 100644 --- a/loader/preloader.c +++ b/loader/preloader.c @@ -4,6 +4,8 @@ @@ -578,7 +571,7 @@ index 5e6add7830f..63cf9eccb12 100644 { int i; -@@ -1125,6 +1357,201 @@ static void remove_preload_range( int i ) +@@ -1125,6 +1357,203 @@ static void remove_preload_range( int i ) } } @@ -695,8 +688,10 @@ index 5e6add7830f..63cf9eccb12 100644 + flags |= MAP_FIXED; + } + -+ wld_printf( "preloader: Warning: failed to reserve range %p-%p\n", -+ info->addr, (char *)info->addr + info->size ); ++ /* don't warn for zero page */ ++ if (info->addr >= (void *)0x1000) ++ wld_printf( "preloader: Warning: failed to reserve range %p-%p\n", ++ info->addr, (char *)info->addr + info->size ); + return 0; +} + @@ -780,7 +775,7 @@ index 5e6add7830f..63cf9eccb12 100644 /* * is_in_preload_range * -@@ -1293,3 +1720,5 @@ void* wld_start( void **stack ) +@@ -1293,3 +1722,5 @@ void* wld_start( void **stack ) return (void *)ld_so_map.l_entry; }