https://bugs.winehq.org/show_bug.cgi?id=46870
--- Comment #44 from Paul Gofman gofmanp@gmail.com --- (In reply to Olivier F. R. Dierick from comment #43)
--- Quote --- the only case for '-fPIC' where a load of GOT register is emitted into prolog code is indeed "no optimization". Gcc seems to intentionally generate "bad" code here, including a redundant load of GOT register. --- Quote ---
I tested wine-staging 4.5 + staged patchset and CFLAGS='-O1 ' and I still get the game error, though.
Please mind "...redundant load of GOT register" in that comment. I suppose if the load of GOT register is not redundant in the specific function (i. e., unlike the function concerned in that bug the GOT register will be actually used), gcc will load GOT register with any optimization level. Unless you use no PIC build which gets rid of that entirely.
I also tested wine-staging 4.5 + staged patchset + the two commits from bug28140 (DECLSPEC_HOTPATCH SizeOfRessource() and FindClose()), in case those were what the game wanted to hotpatch, but it still failed.
Even if it is really related to hotpatching, the chance it is about the same functions is very low. If you want to test for sure if it is hotpacthing vs PIC issue or not, you need to turn on DECLSPEC_HOTPATCH for all winapi functions to see that at once. I suppose you can do that using this patch made by Zebediah (https://www.winehq.org/pipermail/wine-devel/2018-July/128940.html) and full rebuild.