From e98140f91d4f86480343900a572e4a3fe2a10719 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 25 Jul 2023 12:27:50 +0200 Subject: [PATCH] make: Enable Lightrec for GC/Wii Add the missing sysconf() function so that the GC/Wii builds will link properly against Lightrec and GNU Lightning. Signed-off-by: Paul Cercueil --- Makefile | 3 +++ Makefile.libretro | 4 ++-- libpcsxcore/lightrec/sysconf.c | 13 +++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 libpcsxcore/lightrec/sysconf.c diff --git a/Makefile b/Makefile index ee3a44f0..470b9e89 100644 --- a/Makefile +++ b/Makefile @@ -102,6 +102,9 @@ ifeq ($(LIGHTREC_CUSTOM_MAP),1) LDLIBS += -lrt OBJS += $(LIGHTREC_CUSTOM_MAP_OBJ) endif +ifeq ($(NEED_SYSCONF),1) +OBJS += libpcsxcore/lightrec/sysconf.o +endif ifeq ($(LIGHTREC_THREADED_COMPILER),1) OBJS += deps/lightrec/recompiler.o \ deps/lightrec/reaper.o diff --git a/Makefile.libretro b/Makefile.libretro index 5f43eea0..e297bb6d 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -330,10 +330,10 @@ else ifneq (,$(filter $(platform),ngc wii wiiu)) TARGET := $(TARGET_NAME)_libretro_$(platform).a ifeq ($(platform), ngc) CFLAGS += -DHW_DOL -mogc - DYNAREC := 0 # missing sysconf() + NEED_SYSCONF := 1 else ifeq ($(platform), wii) CFLAGS += -DHW_RVL -mrvl - DYNAREC := 0 # missing sysconf() + NEED_SYSCONF := 1 else ifeq ($(platform), wiiu) # -mwup was removed in newer devkitPPC versions CFLAGS += -DHW_WUP diff --git a/libpcsxcore/lightrec/sysconf.c b/libpcsxcore/lightrec/sysconf.c new file mode 100644 index 00000000..6d51bea4 --- /dev/null +++ b/libpcsxcore/lightrec/sysconf.c @@ -0,0 +1,13 @@ +#include +#include + +/* Implement the sysconf() symbol which is needed by GNU Lightning */ +long sysconf(int name) +{ + switch (name) { + case _SC_PAGE_SIZE: + return 4096; + default: + return -EINVAL; + } +} -- 2.39.5