Disable GCC optimization that prevents mod dlls from unloading after engine calls dlclose

This commit is contained in:
Sam V 2023-12-13 20:03:44 +01:00
parent fae5e0180a
commit 6ed0e67000

View file

@ -43,9 +43,12 @@ BASE_CFLAGS=-std=c++17 -fpermissive -fno-strict-aliasing -fno-exceptions -fexpen
BASE_CFLAGS+=-DNDEBUG -DPOSIX -D_POSIX -DLINUX -D_LINUX -DGNUC -DNO_MALLOC_OVERRIDE -DCLIENT_WEAPONS
# flifetime-dse=1 is needed to disable a compiler optimization that optimizes out std::memset calls in CBaseEntity::operator new
# See https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flifetime-dse for more information about the flifetime-dse flag
# See https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flifetime-dse for more information about this flag
# fno-gnu-unique is needed to disable a compiler optimization that prevents dlclose from unloading mod dlls,
# causing them to retain state and crash when the engine tries to access memory in an invalid way
# See https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-gnu-unique for more informatio about this flag
ifeq "$(COMPILER)" "g++"
BASE_CFLAGS+=-flifetime-dse=1
BASE_CFLAGS+=-flifetime-dse=1 -fno-gnu-unique
endif
SHLIBEXT=so