https://bugs.winehq.org/show_bug.cgi?id=55095
Bug ID: 55095 Summary: Compiling preloader with -fPIE may lead to GOTPCREL(X) conversion failure when linking into non-PIE binary Product: Wine Version: 8.10 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: loader Assignee: wine-bugs@winehq.org Reporter: jinoh.kang.kr@gmail.com CC: eric.pouech@gmail.com, julliard@winehq.org Regression SHA1: 78ed343842dcd8ffb95c416420953e121959d40d Distribution: ---
Today, the preloader is linked with -fPIE in spite of the fact that the preloader is a non-PIE statically linked binary. This is due to a limitation in tools/makedep that makes it difficult to specify CFLAGS for each individual object file's recipe.
This can seemingly cause problems with some GOTPCREL(X) relocations inside the preloader. Since preloader does not link to the system library directly, there is no need for Global Offset Tables (GOT). However, a few extern (non-static) function symbols are declared, the use of which makes GCC emit instructions that references those symbols by indirection through GOT. The linker then tries to optimize such instructions to eliminate GOT references, which can fail due to various reasons.
This stands in contradiction with Jinoh Kang's suggestion (in bug 55050) that "-fPIE is harmless even when applied to an object linked into non-PIE executables." The claim is theoretically true since position-independent code can in principle be relocated to any address (fixed or dynamic); however, it fails due to some peculiar practical issues, which is arguably a limitation in the linker's implementation (since it can be worked around --no-relax without issues).
https://bugs.winehq.org/show_bug.cgi?id=55095
--- Comment #1 from Jinoh Kang jinoh.kang.kr@gmail.com --- This bug may depend on binutils / GCC version and configuration, since the relaxation is not always guaranteed to fail.
https://bugs.winehq.org/show_bug.cgi?id=55095
Jinoh Kang jinoh.kang.kr@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=55050
https://bugs.winehq.org/show_bug.cgi?id=55095
--- Comment #2 from Jinoh Kang jinoh.kang.kr@gmail.com --- Created attachment 74656 --> https://bugs.winehq.org/attachment.cgi?id=74656 Hide symbols in preloader
Does this help?
https://bugs.winehq.org/show_bug.cgi?id=55095
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Duplicate.
*** This bug has been marked as a duplicate of bug 55091 ***
https://bugs.winehq.org/show_bug.cgi?id=55095
Jinoh Kang jinoh.kang.kr@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Jinoh Kang jinoh.kang.kr@gmail.com --- Closing.