From 9b592b3ff912367255dba1ddeaffb57df9946c69 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 ++++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 25cbbdf2..1219b097 100644 --- a/Makefile +++ b/Makefile @@ -285,7 +285,7 @@ CFLAGS += -DHAVE_CHD -I$(LCHDR)/include 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 b4e4a710..b45cee2e 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 -- 2.39.5