gentoo-ebuilds/app-emulation/wine-proton/files/wine-proton-9.0.4-binutils2.44.patch
Ionen Wolkens ca693d9324
app-emulation/wine-*: backport mingw binutils-2.44 compat fix
Technically needs a revbump, but this only affects the semi-unsupported
USE=crossdev-mingw with ~arch toolchain given mingw64-toolchain is not
using binutils-2.44 yet (no plans for a while in case of more issues).
Little sense in having typical users rebuild all installed wine(s) esp.
given haven't even gotten a downstream bug report yet beyond a mention
on IRC.

If you are affected (wine will be entirely broken, even winecfg won't
start), then please re-emerge wine & update prefixes. May optionally
want to consider switching to mingw64-toolchain if want to stick to a
tested-with-wine toolchain while at it.

Patch seems to work fine as-is for old versions beside offsets.

For proton it is unclear if it will be still needed when Valve switches
to 10.x given they will likely base it on stable 10.0 rather than
>=10.2, albeit a fixed 10.0.1 might exists before then. Keeping it in
live ebuild for now.

Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
2025-02-14 00:27:34 -05:00

105 lines
4 KiB
Diff

Note that this is only an issue when using mingw (PE) binutils-2.44,
host (ELF) binutils-2.44 has no impact on this and, before this patch,
using 2.44 could only happen with off-by-default USE=crossdev-mingw.
https://bugs.winehq.org/show_bug.cgi?id=57819
https://sourceware.org/PR32675
https://gitlab.winehq.org/wine/wine/-/merge_requests/7328
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -4047,5 +4047,5 @@
NTSTATUS nts;
FARPROC fp;
- DWORD id;
+ INT_PTR id;
TRACE( "(%p, %p, %p, %p, %p, 0x%08lx)\n", base, desc, dllhook, syshook, addr, flags );
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1514,4 +1514,14 @@
}
+static void output_import_section( int index, int is_delay )
+{
+ if (!is_delay)
+ output( "\n\t.section .idata$%d\n", index );
+ else if (index == 5)
+ output( "\n\t.section .data$didat%d\n", index );
+ else
+ output( "\n\t.section .rdata$didat%d\n", index );
+}
+
/* create a Windows-style import library */
static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec, struct strarray files )
@@ -1633,18 +1643,18 @@
output( "\t.long 0\n" ); /* TimeDateStamp */
- output( "\n\t.section .idata$5\n" );
+ output_import_section( 5, is_delay );
output( "\t%s 0\n", get_asm_ptr_keyword() ); /* FirstThunk tail */
output( ".L__wine_import_addrs:\n" );
- output( "\n\t.section .idata$4\n" );
+ output_import_section( 4, is_delay );
output( "\t%s 0\n", get_asm_ptr_keyword() ); /* OriginalFirstThunk tail */
output( ".L__wine_import_names:\n" );
/* required to avoid internal linker errors with some binutils versions */
- output( "\n\t.section .idata$2\n" );
+ output_import_section( 2, is_delay );
}
else
{
- output( "\n\t.section .idata$2\n" );
+ output_import_section( 2, is_delay );
output( "%s\n", asm_globl( import_desc ) );
output_rva( ".L__wine_import_names" ); /* OriginalFirstThunk */
@@ -1654,8 +1664,8 @@
output_rva( ".L__wine_import_addrs" ); /* FirstThunk */
- output( "\n\t.section .idata$4\n" );
+ output_import_section( 4, is_delay );
output( ".L__wine_import_names:\n" ); /* OriginalFirstThunk head */
- output( "\n\t.section .idata$5\n" );
+ output_import_section( 5, is_delay );
output( ".L__wine_import_addrs:\n" ); /* FirstThunk head */
}
@@ -1668,9 +1678,9 @@
new_output_as_file();
- output( "\n\t.section .idata$4\n" );
+ output_import_section( 4, is_delay );
output( "\t%s 0\n", get_asm_ptr_keyword() ); /* OriginalFirstThunk tail */
- output( "\n\t.section .idata$5\n" );
+ output_import_section( 5, is_delay );
output( "\t%s 0\n", get_asm_ptr_keyword() ); /* FirstThunk tail */
- output( "\n\t.section .idata$7\n" );
+ output_import_section( 7, is_delay );
output( "%s\n", asm_globl( import_name ) );
output( "\t%s \"%s\"\n", get_asm_string_keyword(), spec->file_name );
@@ -1763,8 +1773,8 @@
}
- output( "\n\t.section .idata$4\n" );
+ output_import_section( 4, is_delay );
output_thunk_rva( by_name ? -1 : odp->ordinal, ".L__wine_import_name" );
- output( "\n\t.section .idata$5\n" );
+ output_import_section( 5, is_delay );
output( "%s\n", asm_globl( imp_name ) );
if (is_delay)
@@ -1775,5 +1785,5 @@
if (by_name)
{
- output( "\n\t.section .idata$6\n" );
+ output_import_section( 6, is_delay );
output( ".L__wine_import_name:\n" );
output( "\t.short %d\n", odp->hint );
@@ -1782,5 +1792,5 @@
/* reference head object to always pull its sections */
- output( "\n\t.section .idata$7\n" );
+ output_import_section( 7, is_delay );
output_rva( "%s", asm_name( import_desc ) );