https://bugs.winehq.org/show_bug.cgi?id=52676
Stefan Dösinger stefan@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |stefan@codeweavers.com
--- Comment #24 from Stefan Dösinger stefan@codeweavers.com --- Re your question on 55470, I don't think this bug is related. What seems to be going on here is that this DRM tool hooks Win32 API functions. With -march=znver1, gcc generates opcodes that Enigma doesn't understand and fails to hotpatch and/or relocate to the destination of the hook jump.
I think the short answer is "don't do that". Either don't make gcc generate opcodes that Windows doesn't use or don't run code that insists on modifying the machine code of the Windows API implementation.
The long answer is that DECLSPEC_HOTPATCH might help. It'll make 32 bit functions start with 8b ff 55 8b ec, which are easy to replace with a 5 byte jump (And windows uses that sequence a lot). Then gcc can put whatever it wants in the follow-up bytes. On 64 bit it is a bit more complicated. Win64 doesn't have a fixed prologue, it just promises that a few bytes ahead of the function are unused and the first instruction is a 2 byte instruction that can be atomically replaced. GCC will generate a 9 byte NOP at the start instead, which Enigma may or may not understand.