From 46a38bdab1a4d9f578a368705a9e3e144fd81189 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 6 Apr 2022 00:47:25 +0300 Subject: [PATCH] drc: prevent people from using lightrec on arm Can specify ALLOW_LIGHTREC_ON_ARM=1 if you want it that much. --- Makefile.libretro | 5 +++++ libpcsxcore/lightrec/plugin.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Makefile.libretro b/Makefile.libretro index 4c60462c..066da82a 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -66,6 +66,7 @@ else ifneq (,$(findstring CortexA73_G12B,$(platform))) fpic := -fPIC SHARED := -shared -Wl,-version-script=link.T ARCH = arm64 + DYNAREC ?= ari64 CFLAGS += -fomit-frame-pointer -ffast-math -DARM CPUFLAGS += -march=armv8-a+crc -mfpu=neon-fp-armv8 -mcpu=cortex-a73 -mtune=cortex-a73.cortex-a53 @@ -198,6 +199,7 @@ else ifeq ($(platform), libnx) else ifeq ($(platform), arm64) TARGET := $(TARGET_NAME)_libretro.so ARCH := arm64 + DYNAREC = ari64 BUILTIN_GPU = unai fpic := -fPIC CFLAGS := $(filter-out -O2, $(CFLAGS)) @@ -501,6 +503,9 @@ endif ifeq ($(NO_UNDEF_CHECK)$(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU) MAIN_LDFLAGS += -Wl,--no-undefined endif +ifdef ALLOW_LIGHTREC_ON_ARM +CFLAGS += -DALLOW_LIGHTREC_ON_ARM +endif TARGET ?= libretro.so PLATFORM = libretro diff --git a/libpcsxcore/lightrec/plugin.c b/libpcsxcore/lightrec/plugin.c index 99d71756..d042fc4f 100644 --- a/libpcsxcore/lightrec/plugin.c +++ b/libpcsxcore/lightrec/plugin.c @@ -15,6 +15,10 @@ #include "../frontend/main.h" +#if (defined(__arm__) || defined(__aarch64__)) && !defined(ALLOW_LIGHTREC_ON_ARM) +#error "Lightrec should not be used on ARM (please specify DYNAREC=ari64 to make)" +#endif + #define ARRAY_SIZE(x) (sizeof(x) ? sizeof(x) / sizeof((x)[0]) : 0) #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -- 2.39.2