SHA256
1
0
forked from pool/wine
wine/0002-Revert-loader-Always-build-the-main-loader-as-PIE-if.patch
Marcus Meissner 7efe029d35 Accepting request 1095938 from home:favogt:branches:Emulators
- Add reverts to fix startup on 64bit
  (https://bugs.winehq.org/show_bug.cgi?id=55139):
  * 0001-Revert-loader-Build-the-preloader-as-PIE-on-64-bit.patch
  * 0002-Revert-loader-Always-build-the-main-loader-as-PIE-if.patch
  * 0003-Revert-loader-Force-building-the-main-loader-as-PIE-.patch
  * 0004-Revert-loader-Make-the-loader-position-independent-o.patch

OBS-URL: https://build.opensuse.org/request/show/1095938
OBS-URL: https://build.opensuse.org/package/show/Emulators/wine?expand=0&rev=1024
2023-06-29 14:12:38 +00:00

203 lines
9.0 KiB
Diff

From 374a2c3ae41efcdcd99c5c0fb2220d03ea14f372 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Thu, 29 Jun 2023 09:59:35 +0200
Subject: [PATCH 2/4] Revert "loader: Always build the main loader as PIE if we
have a preloader."
This reverts commit c55578f3a54c63084657e7d79c043b22b10df989.
---
configure | 93 +++++++++++++++++++++++++++++++++-------------------
configure.ac | 31 +++++++++---------
2 files changed, 76 insertions(+), 48 deletions(-)
diff --git a/configure b/configure
index 635e3b7f25f..4d00a023d18 100755
--- a/configure
+++ b/configure
@@ -10245,77 +10245,104 @@ if test "x$ac_cv_cflags__Wl___export_dynamic" = xyes
then :
WINELOADER_LDFLAGS="-Wl,--export-dynamic"
fi
+ WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000"
- case $host_os in
- linux*)
- as_fn_append WINELOADER_LDFLAGS " -pie"
- WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000"
- ;;
- *)
- case $HOST_ARCH in
- i386|arm)
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-Ttext-segment=0x60000000" >&5
-printf %s "checking whether the compiler supports -Wl,-Ttext-segment=0x60000000... " >&6; }
-if test ${ac_cv_cflags__Wl__Ttext_segment_0x60000000+y}
+ case $host_cpu in
+ *i[3456789]86* | arm*)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-Ttext-segment=0x7bc00000" >&5
+printf %s "checking whether the compiler supports -Wl,-Ttext-segment=0x7bc00000... " >&6; }
+if test ${ac_cv_cflags__Wl__Ttext_segment_0x7bc00000+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_wine_try_cflags_saved=$CFLAGS
-CFLAGS="$CFLAGS -Wl,-Ttext-segment=0x60000000"
+CFLAGS="$CFLAGS -Wl,-Ttext-segment=0x7bc00000"
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__Ttext_segment_0x60000000=yes
+ ac_cv_cflags__Wl__Ttext_segment_0x7bc00000=yes
else $as_nop
- ac_cv_cflags__Wl__Ttext_segment_0x60000000=no
+ ac_cv_cflags__Wl__Ttext_segment_0x7bc00000=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__Ttext_segment_0x60000000" >&5
-printf "%s\n" "$ac_cv_cflags__Wl__Ttext_segment_0x60000000" >&6; }
-if test "x$ac_cv_cflags__Wl__Ttext_segment_0x60000000" = xyes
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__Ttext_segment_0x7bc00000" >&5
+printf "%s\n" "$ac_cv_cflags__Wl__Ttext_segment_0x7bc00000" >&6; }
+if test "x$ac_cv_cflags__Wl__Ttext_segment_0x7bc00000" = xyes
then :
- as_fn_append WINELOADER_LDFLAGS " -Wl,-Ttext-segment=0x60000000"
+ case $host_os in
+ freebsd* | kfreebsd*-gnu) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-Ttext-segment=0x60000000" ;;
+ *) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-Ttext-segment=0x7d000000" ;;
+ esac
else $as_nop
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--section-start,.interp=0x60000400" >&5
-printf %s "checking whether the compiler supports -Wl,--section-start,.interp=0x60000400... " >&6; }
-if test ${ac_cv_cflags__Wl___section_start__interp_0x60000400+y}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--section-start,.interp=0x7d000400" >&5
+printf %s "checking whether the compiler supports -Wl,--section-start,.interp=0x7d000400... " >&6; }
+if test ${ac_cv_cflags__Wl___section_start__interp_0x7d000400+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_wine_try_cflags_saved=$CFLAGS
-CFLAGS="$CFLAGS -Wl,--section-start,.interp=0x60000400"
+CFLAGS="$CFLAGS -Wl,--section-start,.interp=0x7d000400"
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___section_start__interp_0x60000400=yes
+ ac_cv_cflags__Wl___section_start__interp_0x7d000400=yes
else $as_nop
- ac_cv_cflags__Wl___section_start__interp_0x60000400=no
+ ac_cv_cflags__Wl___section_start__interp_0x7d000400=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl___section_start__interp_0x60000400" >&5
-printf "%s\n" "$ac_cv_cflags__Wl___section_start__interp_0x60000400" >&6; }
-if test "x$ac_cv_cflags__Wl___section_start__interp_0x60000400" = xyes
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl___section_start__interp_0x7d000400" >&5
+printf "%s\n" "$ac_cv_cflags__Wl___section_start__interp_0x7d000400" >&6; }
+if test "x$ac_cv_cflags__Wl___section_start__interp_0x7d000400" = xyes
then :
- as_fn_append WINELOADER_LDFLAGS " -Wl,--section-start,.interp=0x60000400"
+ case $host_os in
+ freebsd* | kfreebsd*-gnu) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,--section-start,.interp=0x60000400" ;;
+ *) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,--section-start,.interp=0x7d000400" ;;
+ esac
fi
fi
- ;;
- *)
- as_fn_append WINELOADER_LDFLAGS " -pie"
- ;;
- esac
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-z,max-page-size=0x1000" >&5
+printf %s "checking whether the compiler supports -Wl,-z,max-page-size=0x1000... " >&6; }
+if test ${ac_cv_cflags__Wl__z_max_page_size_0x1000+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ 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 $as_nop
+ ac_cv_cflags__Wl__z_max_page_size_0x1000=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
+CFLAGS=$ac_wine_try_cflags_saved
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__z_max_page_size_0x1000" >&5
+printf "%s\n" "$ac_cv_cflags__Wl__z_max_page_size_0x1000" >&6; }
+if test "x$ac_cv_cflags__Wl__z_max_page_size_0x1000" = xyes
+then :
+ WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-z,max-page-size=0x1000"
+fi
+ ;;
+ *)
+ WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -pie"
;;
esac
;;
diff --git a/configure.ac b/configure.ac
index c8880886b1c..2255db13046 100644
--- a/configure.ac
+++ b/configure.ac
@@ -769,24 +769,25 @@ case $host_os in
WINE_TRY_CFLAGS([-Wl,-z,defs],[UNIXLDFLAGS="$UNIXLDFLAGS -Wl,-z,defs"])
WINE_TRY_CFLAGS([-Wl,--export-dynamic],[WINELOADER_LDFLAGS="-Wl,--export-dynamic"])
+ WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000"
- case $host_os in
- linux*)
- AS_VAR_APPEND([WINELOADER_LDFLAGS],[" -pie"])
- WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000"
+ case $host_cpu in
+ *i[[3456789]]86* | arm*)
+ WINE_TRY_CFLAGS([-Wl,-Ttext-segment=0x7bc00000],
+ [case $host_os in
+ freebsd* | kfreebsd*-gnu) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-Ttext-segment=0x60000000" ;;
+ *) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-Ttext-segment=0x7d000000" ;;
+ esac],
+ [WINE_TRY_CFLAGS([-Wl,--section-start,.interp=0x7d000400],
+ [case $host_os in
+ freebsd* | kfreebsd*-gnu) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,--section-start,.interp=0x60000400" ;;
+ *) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,--section-start,.interp=0x7d000400" ;;
+ esac])])
+ WINE_TRY_CFLAGS([-Wl,-z,max-page-size=0x1000],
+ [WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-z,max-page-size=0x1000"])
;;
*)
- case $HOST_ARCH in
- i386|arm)
- WINE_TRY_CFLAGS([-Wl,-Ttext-segment=0x60000000],
- [AS_VAR_APPEND([WINELOADER_LDFLAGS],[" -Wl,-Ttext-segment=0x60000000"])],
- [WINE_TRY_CFLAGS([-Wl,--section-start,.interp=0x60000400],
- [AS_VAR_APPEND([WINELOADER_LDFLAGS],[" -Wl,--section-start,.interp=0x60000400"])])])
- ;;
- *)
- AS_VAR_APPEND([WINELOADER_LDFLAGS],[" -pie"])
- ;;
- esac
+ WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -pie"
;;
esac
;;
--
2.41.0