From 7efe029d35a03b3ae66d1ef152519dacf7a4c7cc6f33a263cdf7f759f8843ead Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Thu, 29 Jun 2023 14:12:38 +0000 Subject: [PATCH] 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 --- ...Build-the-preloader-as-PIE-on-64-bit.patch | 126 +++++++++++ ...ways-build-the-main-loader-as-PIE-if.patch | 202 ++++++++++++++++++ ...rce-building-the-main-loader-as-PIE-.patch | 82 +++++++ ...ke-the-loader-position-independent-o.patch | 89 ++++++++ wine.changes | 10 + wine.spec | 5 + 6 files changed, 514 insertions(+) create mode 100644 0001-Revert-loader-Build-the-preloader-as-PIE-on-64-bit.patch create mode 100644 0002-Revert-loader-Always-build-the-main-loader-as-PIE-if.patch create mode 100644 0003-Revert-loader-Force-building-the-main-loader-as-PIE-.patch create mode 100644 0004-Revert-loader-Make-the-loader-position-independent-o.patch diff --git a/0001-Revert-loader-Build-the-preloader-as-PIE-on-64-bit.patch b/0001-Revert-loader-Build-the-preloader-as-PIE-on-64-bit.patch new file mode 100644 index 0000000..f758509 --- /dev/null +++ b/0001-Revert-loader-Build-the-preloader-as-PIE-on-64-bit.patch @@ -0,0 +1,126 @@ +From 8da3c054568e33f682b7282dfe0cdf048960b13a Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Thu, 29 Jun 2023 09:59:30 +0200 +Subject: [PATCH 1/4] Revert "loader: Build the preloader as PIE on 64-bit." + +This reverts commit ac1761d1dae8bf114a05e28ed6886deba6c2c860. +--- + configure | 38 +------------------------------------- + configure.ac | 11 +---------- + loader/preloader.c | 7 +++---- + 3 files changed, 5 insertions(+), 51 deletions(-) + +diff --git a/configure b/configure +index d530de3ced1..635e3b7f25f 100755 +--- a/configure ++++ b/configure +@@ -10245,47 +10245,11 @@ if test "x$ac_cv_cflags__Wl___export_dynamic" = xyes + then : + WINELOADER_LDFLAGS="-Wl,--export-dynamic" + fi +- WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs" + + case $host_os in + linux*) + as_fn_append WINELOADER_LDFLAGS " -pie" +- case $HOST_ARCH in +- i386|arm) +- as_fn_append WINEPRELOADER_LDFLAGS " -static -Wl,-Ttext=0x7d400000" ;; +- *) +- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -static-pie" >&5 +-printf %s "checking whether the compiler supports -static-pie... " >&6; } +-if test ${ac_cv_cflags__static_pie+y} +-then : +- printf %s "(cached) " >&6 +-else $as_nop +- ac_wine_try_cflags_saved=$CFLAGS +-CFLAGS="$CFLAGS -static-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__static_pie=yes +-else $as_nop +- ac_cv_cflags__static_pie=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__static_pie" >&5 +-printf "%s\n" "$ac_cv_cflags__static_pie" >&6; } +-if test "x$ac_cv_cflags__static_pie" = xyes +-then : +- as_fn_append WINEPRELOADER_LDFLAGS " -static-pie" +-else $as_nop +- as_fn_append WINEPRELOADER_LDFLAGS " -static -Wl,-Ttext=0x7d7d00000000" +-fi +- ;; +- esac ++ WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000" + ;; + *) + case $HOST_ARCH in +diff --git a/configure.ac b/configure.ac +index 90c95c89ffb..c8880886b1c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -769,20 +769,11 @@ 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="-nostartfiles -nodefaultlibs" + + case $host_os in + linux*) + AS_VAR_APPEND([WINELOADER_LDFLAGS],[" -pie"]) +- case $HOST_ARCH in +- i386|arm) +- AS_VAR_APPEND([WINEPRELOADER_LDFLAGS],[" -static -Wl,-Ttext=0x7d400000"]) ;; +- *) +- WINE_TRY_CFLAGS([-static-pie], +- [AS_VAR_APPEND([WINEPRELOADER_LDFLAGS],[" -static-pie"])], +- [AS_VAR_APPEND([WINEPRELOADER_LDFLAGS],[" -static -Wl,-Ttext=0x7d7d00000000"])]) +- ;; +- esac ++ WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000" + ;; + *) + case $HOST_ARCH in +diff --git a/loader/preloader.c b/loader/preloader.c +index 635e85ee7cb..5e1eabfa308 100644 +--- a/loader/preloader.c ++++ b/loader/preloader.c +@@ -353,7 +353,7 @@ __ASM_GLOBAL_FUNC(_start, + "movq %rsp,%rax\n\t" + "leaq -144(%rsp),%rsp\n\t" /* allocate some space for extra aux values */ + "movq %rax,(%rsp)\n\t" /* orig stack pointer */ +- "movq thread_data(%rip),%rsi\n\t" ++ "movq $thread_data,%rsi\n\t" + "movq $0x1002,%rdi\n\t" /* ARCH_SET_FS */ + "movq $158,%rax\n\t" /* SYS_arch_prctl */ + "syscall\n\t" +@@ -441,8 +441,7 @@ __ASM_GLOBAL_FUNC(_start, + "mov x0, SP\n\t" + "sub SP, SP, #144\n\t" /* allocate some space for extra aux values */ + "str x0, [SP]\n\t" /* orig stack pointer */ +- "adrp x0, thread_data\n\t" +- "add x0, x0, :lo12:thread_data\n\t" ++ "ldr x0, =thread_data\n\t" + "msr tpidr_el0, x0\n\t" + "mov x0, SP\n\t" /* ptr to orig stack pointer */ + "bl wld_start\n\t" +@@ -1401,7 +1400,7 @@ void* wld_start( void **stack ) + page_size = get_auxiliary( av, AT_PAGESZ, 4096 ); + page_mask = page_size - 1; + +- preloader_start = (char *)((unsigned long)_start & ~page_mask); ++ preloader_start = (char *)_start - ((unsigned long)_start & page_mask); + preloader_end = (char *)((unsigned long)(_end + page_mask) & ~page_mask); + + #ifdef DUMP_AUX_INFO +-- +2.41.0 + diff --git a/0002-Revert-loader-Always-build-the-main-loader-as-PIE-if.patch b/0002-Revert-loader-Always-build-the-main-loader-as-PIE-if.patch new file mode 100644 index 0000000..95a8191 --- /dev/null +++ b/0002-Revert-loader-Always-build-the-main-loader-as-PIE-if.patch @@ -0,0 +1,202 @@ +From 374a2c3ae41efcdcd99c5c0fb2220d03ea14f372 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +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 + diff --git a/0003-Revert-loader-Force-building-the-main-loader-as-PIE-.patch b/0003-Revert-loader-Force-building-the-main-loader-as-PIE-.patch new file mode 100644 index 0000000..23df0d2 --- /dev/null +++ b/0003-Revert-loader-Force-building-the-main-loader-as-PIE-.patch @@ -0,0 +1,82 @@ +From 45b2eb83cc87c8a261f78eb10058ac644d6b5556 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Thu, 29 Jun 2023 09:59:41 +0200 +Subject: [PATCH 3/4] Revert "loader: Force building the main loader as PIE on + 64-bit." + +This reverts commit 78ed343842dcd8ffb95c416420953e121959d40d. +--- + configure | 29 ++++++++++++++++++++++++++++- + configure.ac | 3 ++- + loader/Makefile.in | 1 - + 3 files changed, 30 insertions(+), 3 deletions(-) + +diff --git a/configure b/configure +index 4d00a023d18..a38400ad529 100755 +--- a/configure ++++ b/configure +@@ -10342,7 +10342,34 @@ then : + fi + ;; + *) +- WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -pie" ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-pie" >&5 ++printf %s "checking whether the compiler supports -Wl,-pie... " >&6; } ++if test ${ac_cv_cflags__Wl__pie+y} ++then : ++ printf %s "(cached) " >&6 ++else $as_nop ++ ac_wine_try_cflags_saved=$CFLAGS ++CFLAGS="$CFLAGS -Wl,-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__pie=yes ++else $as_nop ++ ac_cv_cflags__Wl__pie=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__pie" >&5 ++printf "%s\n" "$ac_cv_cflags__Wl__pie" >&6; } ++if test "x$ac_cv_cflags__Wl__pie" = xyes ++then : ++ WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-pie" ++fi + ;; + esac + ;; +diff --git a/configure.ac b/configure.ac +index 2255db13046..b9b3ee4ffc3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -787,7 +787,8 @@ case $host_os in + [WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-z,max-page-size=0x1000"]) + ;; + *) +- WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -pie" ++ WINE_TRY_CFLAGS([-Wl,-pie], ++ [WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-pie"]) + ;; + esac + ;; +diff --git a/loader/Makefile.in b/loader/Makefile.in +index 30413fc8677..7302c231915 100644 +--- a/loader/Makefile.in ++++ b/loader/Makefile.in +@@ -12,7 +12,6 @@ SOURCES = \ + + PROGRAMS = $(WINELOADER_PROGRAMS) + INSTALL_LIB = $(WINELOADER_PROGRAMS) +-UNIX_CFLAGS = -fPIE + + preloader_EXTRADEFS = -fno-builtin + +-- +2.41.0 + diff --git a/0004-Revert-loader-Make-the-loader-position-independent-o.patch b/0004-Revert-loader-Make-the-loader-position-independent-o.patch new file mode 100644 index 0000000..31f0752 --- /dev/null +++ b/0004-Revert-loader-Make-the-loader-position-independent-o.patch @@ -0,0 +1,89 @@ +From 26027b7b84b6fa2fa3b04092c8e6201dc0cad772 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Thu, 29 Jun 2023 09:59:47 +0200 +Subject: [PATCH 4/4] Revert "loader: Make the loader position-independent on + 64-bit." + +This reverts commit cc2cfb9b792bee681b96c5859084fd6d4d0bbed7. +--- + configure | 32 +------------------------------- + configure.ac | 6 +----- + 2 files changed, 2 insertions(+), 36 deletions(-) + +diff --git a/configure b/configure +index a38400ad529..1de33458d28 100755 +--- a/configure ++++ b/configure +@@ -10248,7 +10248,7 @@ fi + WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000" + + case $host_cpu in +- *i[3456789]86* | arm*) ++ *i[3456789]86* | x86_64 | *aarch64* | 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} +@@ -10339,36 +10339,6 @@ 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 +- ;; +- *) +- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-pie" >&5 +-printf %s "checking whether the compiler supports -Wl,-pie... " >&6; } +-if test ${ac_cv_cflags__Wl__pie+y} +-then : +- printf %s "(cached) " >&6 +-else $as_nop +- ac_wine_try_cflags_saved=$CFLAGS +-CFLAGS="$CFLAGS -Wl,-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__pie=yes +-else $as_nop +- ac_cv_cflags__Wl__pie=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__pie" >&5 +-printf "%s\n" "$ac_cv_cflags__Wl__pie" >&6; } +-if test "x$ac_cv_cflags__Wl__pie" = xyes +-then : +- WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-pie" + fi + ;; + esac +diff --git a/configure.ac b/configure.ac +index b9b3ee4ffc3..23f4250220d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -772,7 +772,7 @@ case $host_os in + WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000" + + case $host_cpu in +- *i[[3456789]]86* | arm*) ++ *i[[3456789]]86* | x86_64 | *aarch64* | arm*) + WINE_TRY_CFLAGS([-Wl,-Ttext-segment=0x7bc00000], + [case $host_os in + freebsd* | kfreebsd*-gnu) WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-Ttext-segment=0x60000000" ;; +@@ -786,10 +786,6 @@ case $host_os in + WINE_TRY_CFLAGS([-Wl,-z,max-page-size=0x1000], + [WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-z,max-page-size=0x1000"]) + ;; +- *) +- WINE_TRY_CFLAGS([-Wl,-pie], +- [WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-pie"]) +- ;; + esac + ;; + esac +-- +2.41.0 + diff --git a/wine.changes b/wine.changes index 9d27f4e..f99ecbe 100644 --- a/wine.changes +++ b/wine.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Thu Jun 29 08:01:59 UTC 2023 - Fabian Vogt + +- 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 + ------------------------------------------------------------------- Mon Jun 26 07:57:27 UTC 2023 - Marcus Meissner diff --git a/wine.spec b/wine.spec index 07b7c06..782c73a 100644 --- a/wine.spec +++ b/wine.spec @@ -148,6 +148,11 @@ Source6: wine-msi.desktop Source5: ubuntuwine.tar.bz2 Source7: baselibs.conf Source8: wine-rpmlintrc +# PATCH-FIX-UPSTREAM (hopefully temporary reverts for https://bugs.winehq.org/show_bug.cgi?id=55139) +Patch1: 0001-Revert-loader-Build-the-preloader-as-PIE-on-64-bit.patch +Patch2: 0002-Revert-loader-Always-build-the-main-loader-as-PIE-if.patch +Patch3: 0003-Revert-loader-Force-building-the-main-loader-as-PIE-.patch +Patch4: 0004-Revert-loader-Make-the-loader-position-independent-o.patch # SUSE specific patches # - currently none, but add them here Recommends: wine-gecko >= 2.47.3