1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-03 08:19:41 +00:00
wine/loader
Jinoh Kang 966233aee6 loader: Set the visibility of symbols in preloader to "hidden".
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 a Global Offset Table (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 with -Wl,--no-relax without issues).

Fix this by eliminating GOT usage by setting the default visibility of
non-static declarations to "hidden". Assuming GCC's medium code model
(-mcmodel=medium; default code model for x86_64), this suppresses any
unnecessary PLT or GOT relocations for defined symbols, and provides
opportunity for GCC to optimize the code better.

Fixes: 78ed343842
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55091
2023-06-20 20:27:45 +02:00
..
main.c loader: Unbreak FreeBSD builds (ARRAY_SIZE undefined). 2022-10-31 12:11:55 +01:00
main.h
Makefile.in loader: Force building the main loader as PIE on 64-bit. 2023-06-19 17:30:45 +02:00
preloader_mac.c loader: Reserve some space for 32-bit top-down allocations on 64-bit. 2023-05-31 22:50:10 +02:00
preloader.c loader: Set the visibility of symbols in preloader to "hidden". 2023-06-20 20:27:45 +02:00
wine_info.plist.in
wine.de.UTF-8.man.in loader: Move WineHQ URLs to https. 2017-12-01 09:22:33 +01:00
wine.desktop
wine.fr.UTF-8.man.in loader: Move WineHQ URLs to https. 2017-12-01 09:22:33 +01:00
wine.inf.in wine.inf: Use FLG_ADDREG_NOCLOBBER for CurrentMajor/MinorVersionNumber. 2023-04-17 18:55:41 +02:00
wine.man.in loader: Document the WINE_D3D_CONFIG environment variable. 2023-01-24 15:22:49 +01:00
wine.pl.UTF-8.man.in loader/wine.pl.UTF-8.man.in: Move WineHQ URL to https. 2017-12-07 19:13:55 +01:00