From 2f609094ad9ec14212fb730897ccb63f2f44bc40 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 30 May 2022 19:22:17 +0100 Subject: [PATCH] Fix Lightrec build on Windows and Linux Some distributions of Linux don't have the MFD_HUGETLB flag in , probably because their kernel headers installed are too old. In that case, we locally define MFD_HUGETLB to the value it should have. On Windows, the HAVE_MMAP macro set for GNU Lightning was also used in libretro-common/vfs/vfs_implementation.c, causing build issues. Address this problem by only defining HAVE_MMAP for Lightning source files. Signed-off-by: Paul Cercueil --- Makefile | 3 ++- libpcsxcore/lightrec/mem.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d1585a17..0860c722 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,8 @@ libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull # dynarec ifeq "$(DYNAREC)" "lightrec" CFLAGS += -Ideps/lightning/include -Ideps/lightrec -Iinclude/lightning -Iinclude/lightrec \ - -DLIGHTREC -DLIGHTREC_STATIC -DHAVE_MMAP + -DLIGHTREC -DLIGHTREC_STATIC +deps/lightning/lib/%.o: CFLAGS += -DHAVE_MMAP ifeq ($(LIGHTREC_CUSTOM_MAP),1) LDLIBS += -lrt OBJS += libpcsxcore/lightrec/mem.o diff --git a/libpcsxcore/lightrec/mem.c b/libpcsxcore/lightrec/mem.c index 76608ea4..c7fa7da7 100644 --- a/libpcsxcore/lightrec/mem.c +++ b/libpcsxcore/lightrec/mem.c @@ -25,6 +25,10 @@ #define MAP_FIXED_NOREPLACE 0x100000 #endif +#ifndef MFD_HUGETLB +#define MFD_HUGETLB 0x0004 +#endif + static const uintptr_t supported_io_bases[] = { 0x0, 0x10000000, -- 2.39.2