From 059bddbcbe0b5dfe2dffc621bca63edeaee3c1eb Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 26 Oct 2024 22:57:57 +0300 Subject: [PATCH] platforms: try to fix build many lack weak symbols, apple has different pthread_setname_np... --- Makefile | 2 +- frontend/cspace.c | 4 ++++ frontend/libretro-rthreads.c | 2 +- include/compiler_features.h | 7 ++++++- jni/Android.mk | 11 +++++++---- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 89e54ffd..7f95fe4a 100644 --- a/Makefile +++ b/Makefile @@ -319,7 +319,7 @@ endif OBJS += frontend/cspace.o ifeq "$(HAVE_NEON_ASM)" "1" OBJS += frontend/cspace_neon.o -frontend/cspace.o: CFLAGS += -DHAVE_bgr555_to_rgb565 +frontend/cspace.o: CFLAGS += -DHAVE_bgr555_to_rgb565 -DHAVE_bgr888_to_x else ifeq "$(ARCH)" "arm" OBJS += frontend/cspace_arm.o diff --git a/frontend/cspace.c b/frontend/cspace.c index 2d5349ef..0a00163f 100644 --- a/frontend/cspace.c +++ b/frontend/cspace.c @@ -112,6 +112,8 @@ void bgr555_to_rgb565(void *dst_, const void *src_, int bytes) #endif +#ifndef HAVE_bgr888_to_x + void attr_weak bgr888_to_rgb565(void *dst_, const void *src_, int bytes) { const unsigned char *src = src_; @@ -139,6 +141,8 @@ void attr_weak bgr888_to_rgb565(void *dst_, const void *src_, int bytes) void rgb888_to_rgb565(void *dst, const void *src, int bytes) {} void bgr888_to_rgb888(void *dst, const void *src, int bytes) {} +#endif // HAVE_bgr888_to_x + /* YUV stuff */ static int yuv_ry[32], yuv_gy[32], yuv_by[32]; static unsigned char yuv_u[32 * 2], yuv_v[32 * 2]; diff --git a/frontend/libretro-rthreads.c b/frontend/libretro-rthreads.c index 24507508..82af3ef2 100644 --- a/frontend/libretro-rthreads.c +++ b/frontend/libretro-rthreads.c @@ -83,7 +83,7 @@ sthread_t *pcsxr_sthread_create(void (*thread_func)(void *), h->id = (pthread_t)ctr_thread; #else h = sthread_create(thread_func, NULL); - #if defined(__GLIBC__) || defined(__MACH__) || \ + #if defined(__GLIBC__) || \ (defined(__ANDROID_API__) && __ANDROID_API__ >= 26) if (h && (unsigned int)type < (unsigned int)PCSXRT_COUNT) { diff --git a/include/compiler_features.h b/include/compiler_features.h index d6983632..21549ddf 100644 --- a/include/compiler_features.h +++ b/include/compiler_features.h @@ -8,12 +8,17 @@ # define noinline __attribute__((noinline,noclone)) # endif # define attr_unused __attribute__((unused)) -# define attr_weak __attribute__((weak)) #else # define likely(x) (x) # define unlikely(x) (x) # define noinline # define attr_unused +#endif + +// doesn't work on Android, mingw... +#if defined(__GNUC__) && !defined(ANDROID) && !defined(__MINGW32__) +# define attr_weak __attribute__((weak)) +#else # define attr_weak #endif diff --git a/jni/Android.mk b/jni/Android.mk index eeafc4ec..aacf89f5 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -205,10 +205,7 @@ endif ifeq ($(HAVE_GPU_NEON),1) COREFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP -DGPU_NEON ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) - COREFLAGS += -DHAVE_bgr555_to_rgb565 -DHAVE_bgr888_to_x - SOURCES_ASM += $(CORE_DIR)/gte_neon.S \ - $(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S \ - $(FRONTEND_DIR)/cspace_neon.S + SOURCES_ASM += $(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S else COREFLAGS += -DSIMD_BUILD SOURCES_C += $(NEON_DIR)/psx_gpu/psx_gpu_simd.c @@ -225,6 +222,12 @@ else SOURCES_C += $(PEOPS_DIR)/gpulib_if.c endif +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) + COREFLAGS += -DHAVE_bgr555_to_rgb565 -DHAVE_bgr888_to_x + SOURCES_ASM += $(CORE_DIR)/gte_neon.S \ + $(FRONTEND_DIR)/cspace_neon.S +endif + ifeq ($(USE_ASYNC_CDROM),1) COREFLAGS += -DUSE_ASYNC_CDROM USE_RTHREADS := 1 -- 2.39.5