build: Build PE modules with -mcmodel=small.

This breaks MinGW autoimport mechanism but nothing in Proton should be
using it. Instead, any PE module should be using standard dllimport and
ntdll will do the relocations as expected. We also don't and hopefully
never have modules larger than 2GB, so 32-bit %rip relative offsets
should be enough for everything.

This will OTOH save a lot of .refptr indirections, that are otherwise
generated for any extern symbols, even though they are later linked in
the same module, making all code smaller and maybe a little faster.
This commit is contained in:
Rémi Bernon 2022-12-11 15:06:06 +01:00 committed by Arkadiusz Hiler
parent 470f3084eb
commit db3274b1c7
2 changed files with 2 additions and 1 deletions

View file

@ -180,6 +180,7 @@ SANITY_FLAGS := -fwrapv -fno-strict-aliasing
DEBUG_FLAGS := -gdwarf-2 -gstrict-dwarf
COMMON_FLAGS = $(DEBUG_FLAGS) $(OPTIMIZE_FLAGS) $(SANITY_FLAGS) -ffile-prefix-map=$(CCACHE_BASEDIR)=.
COMMON_FLAGS32 := -mstackrealign
COMMON_FLAGS64 := -mcmodel=small
CARGO_BUILD_ARG := --release
##

View file

@ -182,7 +182,7 @@ function configure() {
#
arg_steamrt="soldier"
arg_protonsdk_image="registry.gitlab.steamos.cloud/proton/soldier/sdk:0.20220601.0-1"
arg_protonsdk_image="registry.gitlab.steamos.cloud/proton/soldier/sdk:0.20220601.0-4"
arg_no_protonsdk=""
arg_build_name=""
arg_container_engine=""