From: Ken Thomases Subject: configure: For Mac, link wineloader with -no_pie if it's available. Message-Id: <3CBB7E15-CB16-477C-86F8-B54B714271EB@codeweavers.com> Date: Thu, 16 Oct 2014 22:03:11 -0500 This is necessary for the specified image base and WINE_DOS and WINE_SHAREDHEAP segment addresses to be respected. The latter are necessary to reserve the correct ranges of the address space. This replaces the use of -macosx_version_min 10.6 which I believe was a poor- man's way to achieve the same thing, but which was only used when building on OS X 10.7 (as opposed to 10.7 _and later_). For . --- configure | 28 +++++++++++++++++++++++++--- configure.ac | 5 ++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 2228ce3..f57c9ad 100755 --- a/configure +++ b/configure @@ -7719,9 +7719,31 @@ uninstall:: APPKIT_LIBS="-framework AppKit" LDEXECFLAGS="-image_base 0x7bf00000 -Wl,-segaddr,WINE_DOS,0x00001000,-segaddr,WINE_SHAREDHEAP,0x7f000000,-sectcreate,__TEXT,__info_plist,wine_info.plist" - case $host_os in - darwin11*) LDEXECFLAGS="-Wl,-macosx_version_min,10.6 $LDEXECFLAGS" ;; - esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-no_pie" >&5 +$as_echo_n "checking whether the compiler supports -Wl,-no_pie... " >&6; } +if ${ac_cv_cflags__Wl__no_pie+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_wine_try_cflags_saved=$CFLAGS +CFLAGS="$CFLAGS -Wl,-no_pie" +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__no_pie=yes +else + ac_cv_cflags__Wl__no_pie=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__no_pie" >&5 +$as_echo "$ac_cv_cflags__Wl__no_pie" >&6; } +if test "x$ac_cv_cflags__Wl__no_pie" = xyes; then : + LDEXECFLAGS="-Wl,-no_pie $LDEXECFLAGS" +fi if test "$ac_cv_header_DiskArbitration_DiskArbitration_h" = "yes" then DISKARBITRATION_LIBS="-framework DiskArbitration -framework CoreFoundation" diff --git a/configure.ac b/configure.ac index 240ce29..5ebc2c3 100644 --- a/configure.ac +++ b/configure.ac @@ -760,9 +760,8 @@ uninstall:: AC_SUBST(CORESERVICES_LIBS,"-framework CoreServices") AC_SUBST(APPKIT_LIBS,"-framework AppKit") LDEXECFLAGS="-image_base 0x7bf00000 -Wl,-segaddr,WINE_DOS,0x00001000,-segaddr,WINE_SHAREDHEAP,0x7f000000,-sectcreate,__TEXT,__info_plist,wine_info.plist" - case $host_os in - darwin11*) LDEXECFLAGS="-Wl,-macosx_version_min,10.6 $LDEXECFLAGS" ;; - esac + WINE_TRY_CFLAGS([-Wl,-no_pie], + [LDEXECFLAGS="-Wl,-no_pie $LDEXECFLAGS"]) 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