From c046b83ce92e4ab746f9840b7cd2d33063e2082e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 10 Nov 2026 19:40:09 +0100 Subject: [PATCH] Android: Link ppsspp_jni with -Bsymbolic-functions Calls between functions in the library went through PLT stubs, since it's built with default visibility. The stubs were about 5% of JIT compile time on a Galaxy S8 (the IR passes call many small helpers in other files), and a few percent of the emulator thread in general. --jit-bench: 27 -> 25 us per block. Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 3 +++ android/jni/Android.mk | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 541b18db60..0cd3d47eef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1129,6 +1129,9 @@ if(ANDROID AND NOT LIBRETRO) # what openxr_loader was previously only being linked into. target_link_libraries(ppsspp_jni openxr_loader) endif() + # Calls between our own functions bind directly, rather than through the PLT (which cost a few + # percent of the emulator thread on a Galaxy S8). Nothing outside needs to interpose them. + target_link_options(ppsspp_jni PRIVATE "-Wl,-Bsymbolic-functions") if(ARM64) # Support 16kb page size on Android target_link_options(ppsspp_jni PRIVATE "-Wl,-z,max-page-size=16384") diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 0f7aaa319c..b0901e8450 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -1140,6 +1140,9 @@ LOCAL_SRC_FILES := \ $(SRC)/UI/CustomButtonMappingScreen.cpp \ $(SRC)/UI/RetroAchievementScreens.cpp +# Calls between our own functions bind directly, not through the PLT (see CMakeLists.txt). +LOCAL_LDFLAGS += -Wl,-Bsymbolic-functions + ifneq ($(SKIPAPP),1) include $(BUILD_SHARED_LIBRARY) endif