From 20bcf64f169f356139c485cd6c636f2a17e7e65a Mon Sep 17 00:00:00 2001 From: vkc-1974 <44870873+vkc-1974@users.noreply.github.com> Date: Mon, 6 Dec 2021 03:47:03 +0300 Subject: [PATCH] Initial release --- Makefile | 19 +++++++++++++++++++ README.md | 25 ++++++++++++++++++++++++- libc_dlopen_mode.c | 17 +++++++++++++++++ version.map | 4 ++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 Makefile create mode 100644 libc_dlopen_mode.c create mode 100644 version.map diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a3297cb --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +.PHONY: all clean + +RES_LIB_NAME = liblibc_dlopen_mode +RES_LIB = $(RES_LIB_NAME).so +SRCS = \ + libc_dlopen_mode.c + +CFLAGS += -fpic -shared -flto -Wl,--version-script -Wl,version.map -Wl,--as-needed + +# +# Add `--save-temp` to collect more details about created shared library + +all: $(RES_LIB) + +$(RES_LIB): $(SRCS) version.map + $(CC) $(CFLAGS) -o $@ $(SRCS) + +clean: + $(RM) $(RES_LIB) diff --git a/README.md b/README.md index 8f461bf..48194ff 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ # XCOM2WotC-f35 -Small shared library to fix glibc compatibility issue to Steam's XCOM2 WotC game for Fedora 35 (and above i hope) +Small shared library to fix glibc compatibility issue to Steam's XCOM2 WotC game for Fedora 35 (and above i hope). +Unfortunately `XCOM2WotC` binary executable was built in a bit wrong way and adeded the referencese to GLibC's +private functions (since GLibC 2.34). I hope it will be fixed by product development team soon. +If you are lucky enough ;) (like me) and have updated your Fedora Linux to 35 you can use a small trick given project +provides: it just creates synonyms to GLibC's public functions; you just need to build a shared library ask dynamic +linker to preload it so that `XCOM2WotC` application could use missing routines. + +## Build + +make + +## Preload activation + +There are two way to do it: + +* using of LD_PRELOAD environment variable (e.g. export LD_PRELOAD=) +* update `Steam/steamapps/common/XCOM 2/XCOM2WotC/XCOM2WotC.sh` shell script used by `steam` application to start the game running: + look for `LD_PRELOAD_ADDITIONS=` instruction and add the path to `liblibc_dlopen_mode.so` library there + +## Known issues + +Unfortunately space symbols in the path to `liblibc_dlopen_mode.so` library are not supported by `Steam/steamapps/common/XCOM 2/XCOM2WotC/XCOM2WotC.sh` +script out of the box. I am quite lazy to look for a solution as i am happy enough with given fix. + diff --git a/libc_dlopen_mode.c b/libc_dlopen_mode.c new file mode 100644 index 0000000..4a6c610 --- /dev/null +++ b/libc_dlopen_mode.c @@ -0,0 +1,17 @@ +// File :libc_dlopen_mode.c +// Author :mouse197410 +// Created :Mon Dec 6 01:53:56 2021 +#include + +__attribute__((__symver__("__libc_dlopen_mode@GLIBC_PRIVATE"))) +void* libc_dlopen_mode(const char *filename, int flags) +{ + return dlopen(filename, flags); +} + +__attribute__((__symver__("__libc_dlsym@GLIBC_PRIVATE"))) +void *libc_dlsym(void *restrict handle, const char *restrict symbol) +{ + return dlsym(handle, symbol); +} + diff --git a/version.map b/version.map new file mode 100644 index 0000000..b8361e9 --- /dev/null +++ b/version.map @@ -0,0 +1,4 @@ +GLIBC_PRIVATE { +global: + *; +};