https://bugs.winehq.org/show_bug.cgi?id=55863
Bug ID: 55863 Summary: Wine fails to build on macOS with LLVM 17 Product: Wine Version: 8.19 Hardware: x86-64 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: bshanks@codeweavers.com
When building Wine on macOS with LLVM 17 (i.e. from Homebrew), the build fails with:
clang -arch x86_64 -m64 -c -o dlls/ntdll/unix/signal_x86_64.o ../dlls/ntdll/unix/signal_x86_64.c -Idlls/ntdll -I../dlls/ntdll -Iinclude \ -I../include -D__WINESRC__ -D_NTSYSTEM_ -D_ACRTIMP= -DWINBASEAPI= -DWINE_UNIX_LIB -Wall -pipe \ -fcf-protection=none -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement \ -Wempty-body -Wignored-qualifiers -Winit-self -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits \ -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -gdwarf-4 -fPIC \ -fasynchronous-unwind-tables -g -O2 -fPIC -Wall -Wdeclaration-after-statement -Wwrite-strings -Wtype-limits -march=core2 -mfpmath=sse -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 In file included from ../dlls/ntdll/unix/signal_x86_64.c:81: ../dlls/ntdll/unix/dwarf.h:915:45: warning: taking the absolute value of unsigned type 'ULONG_PTR' (aka 'unsigned long') has no effect [-Wabsolute-value] 915 | case DW_OP_abs: stack[sp] = labs(stack[sp]); break; | ^ ../dlls/ntdll/unix/dwarf.h:915:45: note: remove the call to 'labs' since unsigned values cannot be negative 915 | case DW_OP_abs: stack[sp] = labs(stack[sp]); break; | ^~~~ <inline asm>:159:2: error: invalid CFI advance_loc expression 159 | .cfi_escape 0x10, 0x03, 0x02, 0x72, 0x08 | ^ <inline asm>:362:2: error: invalid CFI advance_loc expression 362 | .cfi_escape 0x10, 0x03, 0x02, 0x72, 0x08 | ^ 1 warning and 2 errors generated. make: *** [dlls/ntdll/unix/signal_x86_64.o] Error 1
This is caused by a recent LLVM change to "reject CFI advance_loc separated by a non-private label for Mach-O":
https://reviews.llvm.org/D153167
I believe the lines causing errors are '__ASM_CFI_REG_IS_AT1(rbx, rcx, 0x08)' in __wine_syscall_dispatcher and '__ASM_CFI_REG_IS_AT1(rbx, rcx, 0x08)' in __wine_unix_call_dispatcher, but it's not specifically those lines, the problem is all the CFI advance_loc calls in those functions after the .globl labels.
https://bugs.winehq.org/show_bug.cgi?id=55863
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source
https://bugs.winehq.org/show_bug.cgi?id=55863
Jacek Caban jacek@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jacek@codeweavers.com
--- Comment #1 from Jacek Caban jacek@codeweavers.com --- Created attachment 75502 --> https://bugs.winehq.org/attachment.cgi?id=75502 Make lebels local
Those labels don't really need to be global, does the attached patch help?
https://bugs.winehq.org/show_bug.cgi?id=55863
--- Comment #2 from Brendan Shanks bshanks@codeweavers.com --- (In reply to Jacek Caban from comment #1)
Created attachment 75502 [details] Make lebels local
Those labels don't really need to be global, does the attached patch help?
No, I still get 'error: invalid CFI advance_loc expression' errors.
I have two ideas for fixes:
- add NOPs into the dispatchers and search for those in handle_syscall_trap(): https://gitlab.winehq.org/bshanks/wine/-/commit/28f2cf9647eda129b4d148558a96...
- or, use JMPs to skip the prolog when necessary: https://gitlab.winehq.org/bshanks/wine/-/commit/a3bfc23632569764d91c6665a537...
I'm not sure which one I prefer, any better ideas are welcome.
https://bugs.winehq.org/show_bug.cgi?id=55863
Brendan Shanks bshanks@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |295d521b11644fb76c36854336b | |13c2155bb7d79
--- Comment #3 from Brendan Shanks bshanks@codeweavers.com --- This is fixed with 295d521b11644fb76c36854336b13c2155bb7d79 ("ntdll: Fix macOS build error with LLVM 17.")
https://bugs.winehq.org/show_bug.cgi?id=55863
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.0-rc2.