https://bugs.winehq.org/show_bug.cgi?id=55050
--- Comment #5 from Jinoh Kang jinoh.kang.kr@gmail.com --- (In reply to Alexandre Julliard from comment #3)
Created attachment 74624 [details] Force PIE
Does this help?
Yes, it does. Thank you! I have a few more comments:
1. -Wl,-pie alone does not instruct GCC to use the PIE version of crtbegin.o (crtbeginS.o; note the "S"). crtbegin.o may use relocations that are incompatible with PIE or PIC (e.g., R_X86_64_32 cannot represent displacements possible in a large code model) which leads to linker error.
2. AFAIK -fPIE is harmless even when applied to an object linked into non-PIE executables, so I think it doesn't hurt to specify it as UNIX_CFLAGS (if it works) for loader/Makefile.in. The preloader (still non-PIE and has fixed address) might get slightly bloated due to PIC/PIE code (but work just fine), though.