[PATCH] configure: Fix building of the preloader on the Mac using Xcode 10 or later.

Ken Thomases ken at codeweavers.com
Fri Dec 7 15:11:07 CST 2018


The linker that comes with Xcode 10 requires that libSystem be linked for
dynamic executables (those using dyld) unless -mmacosx-version-min=10.7 (or
earlier) is used.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
This suggests that the future is grim for the approach taken for the Mac
preloader.  This is a stopgap measure.  We've filed a bug with Apple asking
that this capability be restored or, failing that, that they provide another
way to do the address space reservations we need before system libraries can
interfere.  The alternative is to revert the Mac preloader implementation.


 configure.ac | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 08fbc3c..26fc392 100644
--- a/configure.ac
+++ b/configure.ac
@@ -717,6 +717,7 @@ wine_binary="wine"
 test "x$enable_win64" != "xyes" || wine_binary="wine64"
 AC_SUBST(WINELOADER_PROGRAMS,"$wine_binary")
 libwine_soversion=`expr $libwine_version : '\([[0-9]]*\)\..*'`
+wine_can_build_preloader=yes
 
 case $host_os in
   cygwin*|mingw32*)
@@ -772,9 +773,20 @@ case $host_os in
 
     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],
-                    [WINEPRELOADER_LDFLAGS="-Wl,-no_pie $WINEPRELOADER_LDFLAGS"])
+                    [WINEPRELOADER_LDFLAGS="-Wl,-no_new_main $WINEPRELOADER_LDFLAGS"
+                     WINE_TRY_CFLAGS([-Wl,-no_new_main -e _main -nostartfiles -nodefaultlibs],,
+                        [WINE_TRY_CFLAGS([-Wl,-no_new_main -e _main -mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs],
+                                         [WINEPRELOADER_LDFLAGS="-mmacosx-version-min=10.7 $WINEPRELOADER_LDFLAGS"],
+                                         [wine_can_build_preloader=no])])],
+                    [WINE_TRY_CFLAGS([-nostartfiles -nodefaultlibs],,
+                        [WINE_TRY_CFLAGS([-mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs],
+                                         [WINEPRELOADER_LDFLAGS="-mmacosx-version-min=10.7 $WINEPRELOADER_LDFLAGS"],
+                                         [wine_can_build_preloader=no])])])
+    if test "$wine_can_build_preloader" = "yes"
+    then
+        WINE_TRY_CFLAGS([-Wl,-no_pie],
+                        [WINEPRELOADER_LDFLAGS="-Wl,-no_pie $WINEPRELOADER_LDFLAGS"])
+    fi
 
     if test "$ac_cv_header_DiskArbitration_DiskArbitration_h" = "yes"
     then
@@ -2110,25 +2122,35 @@ case $build_os in
   cygwin*|mingw32*) AC_SUBST(TOOLSEXT,".exe") ;;
 esac
 
+wine_want_preloader=no
 case $host_os in
   linux*)
     case $host_cpu in
       *i[[3456789]]86*|x86_64*|*aarch64*)
-        test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine-preloader")
-        WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
+        wine_want_preloader=yes
         ;;
     esac
     ;;
   darwin*|macosx*)
     case $host_cpu in
       *i[[3456789]]86*|x86_64*)
-        test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine-preloader")
-        WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
+        wine_want_preloader=yes
         ;;
     esac
     ;;
 esac
 
+if test "$wine_want_preloader" = "yes"
+then
+  if test "$wine_can_build_preloader" = "yes"
+  then
+    test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine-preloader")
+    WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
+  else
+    WINE_WARNING([can't build Wine preloader; many programs won't work])
+  fi
+fi
+
 dnl **** Check for functions ****
 
 ac_save_CFLAGS="$CFLAGS"
-- 
2.10.2




More information about the wine-devel mailing list