git: a9a707cc8f11 - main - emulators/wine-devel: Unbreak on i386
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 01 Nov 2023 12:33:12 UTC
The branch main has been updated by gerald: URL: https://cgit.FreeBSD.org/ports/commit/?id=a9a707cc8f112c79b6d8cbf9ab0f75bd99294cfa commit a9a707cc8f112c79b6d8cbf9ab0f75bd99294cfa Author: Gerald Pfeifer <gerald@FreeBSD.org> AuthorDate: 2023-11-01 12:17:22 +0000 Commit: Gerald Pfeifer <gerald@FreeBSD.org> CommitDate: 2023-11-01 12:32:50 +0000 emulators/wine-devel: Unbreak on i386 Revert an upstream change to tools/winebuild/res32.c that exposed resource contraints for clang on i386 (cf. the upstream reports at https://github.com/llvm/llvm-project/issues/62339 and https://bugs.winehq.org/show_bug.cgi?id=54889 ). Apply this patch only on i386 to minimize divergence and risk on 64-bit x86. PR: 273987 [1], 271201 [2] Bi-sected by: Damjan Jovanovic <damjan.jov@gmail.com> [2] Motivated by: scf [1] --- emulators/wine-devel/Makefile | 2 +- .../files/extra-patch-tools-winebuild-res32 | 95 ++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) diff --git a/emulators/wine-devel/Makefile b/emulators/wine-devel/Makefile index a3659db22d33..11a96abed229 100644 --- a/emulators/wine-devel/Makefile +++ b/emulators/wine-devel/Makefile @@ -14,7 +14,6 @@ LICENSE_COMB= dual LICENSE_FILE= ${WRKSRC}/LICENSE ONLY_FOR_ARCHS= amd64 i386 -BROKEN_i386= fails to build: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271201\#c6 BUILD_DEPENDS= ${LOCALBASE}/bin/flex:textproc/flex llvm${_LLVM_VERSION}>=0:devel/llvm${_LLVM_VERSION} @@ -147,6 +146,7 @@ post-patch: ${REINPLACE_CMD} '/Exec/s|wine|wine64|g' ${WRKSRC}/loader/wine.desktop .else +EXTRA_PATCHES+= files/extra-patch-tools-winebuild-res32 PLIST_SUB+= WINE32="" WINE64="@comment " WINEARCH="i386" .endif diff --git a/emulators/wine-devel/files/extra-patch-tools-winebuild-res32 b/emulators/wine-devel/files/extra-patch-tools-winebuild-res32 new file mode 100644 index 000000000000..7c6c62b9fe58 --- /dev/null +++ b/emulators/wine-devel/files/extra-patch-tools-winebuild-res32 @@ -0,0 +1,95 @@ +The upstream change + + commit 0b3f90ab1485d5bd32bd72d41c7fd8213b3b95b9 + Author: RĂ©mi Bernon <rbernon@codeweavers.com> + Date: Sat Feb 11 11:05:22 2023 +0100 + + winebuild: Use .incbin instead of printf for resource data. + +apparently causes some (not completely reproducible) build +issues on i386 due to resource exhaustion by the compiler, +cf. https://bugs.winehq.org/show_bug.cgi?id=54889 . + +https://github.com/llvm/llvm-project/issues/62339 tracks this on +the LLVM side, alas has not really seen progress since April 2003. +So for now this reverts the upstream commit (alas on i386 only as +to minimize divergence and risk on 64-bit x86). + + +--- tools/winebuild/res32.c ++++ tools/winebuild/res32.c +@@ -44,8 +44,6 @@ struct resource + { + struct string_id type; + struct string_id name; +- const char *input_name; +- unsigned int input_offset; + const void *data; + unsigned int data_size; + unsigned int data_offset; +@@ -158,6 +156,28 @@ static void put_string( const struct string_id *str ) + } + } + ++static void dump_res_data( const struct resource *res ) ++{ ++ unsigned int i = 0; ++ unsigned int size = (res->data_size + 3) & ~3; ++ ++ if (!size) return; ++ ++ input_buffer = res->data; ++ input_buffer_pos = 0; ++ input_buffer_size = size; ++ ++ output( "\t.long " ); ++ while (size > 4) ++ { ++ if ((i++ % 16) == 15) output( "0x%08x\n\t.long ", get_dword() ); ++ else output( "0x%08x,", get_dword() ); ++ size -= 4; ++ } ++ output( "0x%08x\n", get_dword() ); ++ assert( input_buffer_pos == input_buffer_size ); ++} ++ + /* check the file header */ + /* all values must be zero except header size */ + static int check_header(void) +@@ -179,7 +199,7 @@ static int check_header(void) + } + + /* load the next resource from the current file */ +-static void load_next_resource( DLLSPEC *spec, const char *name ) ++static void load_next_resource( DLLSPEC *spec ) + { + unsigned int hdr_size; + struct resource *res = add_resource( spec ); +@@ -189,9 +209,6 @@ static void load_next_resource( DLLSPEC *spec, const char *name ) + if (hdr_size & 3) fatal_error( "%s header size not aligned\n", input_buffer_filename ); + if (hdr_size < 32) fatal_error( "%s invalid header size %u\n", input_buffer_filename, hdr_size ); + +- res->input_name = xstrdup( name ); +- res->input_offset = input_buffer_pos - 2*sizeof(unsigned int) + hdr_size; +- + res->data = input_buffer + input_buffer_pos - 2*sizeof(unsigned int) + hdr_size; + if ((const unsigned char *)res->data < input_buffer || + (const unsigned char *)res->data >= input_buffer + input_buffer_size) +@@ -220,7 +237,7 @@ int load_res32_file( const char *name, DLLSPEC *spec ) + + if ((ret = check_header())) + { +- while (input_buffer_pos < input_buffer_size) load_next_resource( spec, name ); ++ while (input_buffer_pos < input_buffer_size) load_next_resource( spec ); + } + return ret; + } +@@ -473,7 +490,7 @@ void output_resources( DLLSPEC *spec ) + { + output( "\n\t.balign 4\n" ); + output( ".L__wine_spec_res_%d:\n", i ); +- output( "\t.incbin \"%s\",%d,%d\n", res->input_name, res->input_offset, res->data_size ); ++ dump_res_data( res ); + } + + if (!is_pe())