Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ android {
excludes.add("META-INF/DEPENDENCIES")
excludes.add("META-INF/gradle/incremental.annotation.processors")
}
// Note: Native libraries (.so files) are configured to be uncompressed via the noCompress set
// below. All locally-built native libraries have been configured with 16 KB page alignment
// linker flags (-Wl,-z,max-page-size=16384). External dependencies (libandroid-tree-sitter.so,
// libdt_socket.so, libjdwp.so, libnpt.so) require updates from their maintainers for 16 KB alignment.
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
Expand Down
1 change: 1 addition & 0 deletions llama-impl/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ add_library(${CMAKE_PROJECT_NAME} SHARED
# Specifies libraries CMake should link to your target library. You
# can link libraries from various origins, such as libraries defined in this
# build script, prebuilt third-party libraries, or Android system libraries.
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE -Wl,-z,max-page-size=16384)
target_link_libraries(${CMAKE_PROJECT_NAME}
# List libraries link to the target library
llama
Expand Down
5 changes: 4 additions & 1 deletion subprojects/shizuku-manager/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message("Builing Release...")

add_compile_options(-Os -flto -fvisibility=hidden -fvisibility-inlines-hidden)
add_link_options(-flto -Wl,--exclude-libs,ALL -Wl,--gc-sections -Wl,--strip-all)
add_link_options(-flto -Wl,--exclude-libs,ALL -Wl,--gc-sections -Wl,--strip-all -Wl,-z,max-page-size=16384)
else ()
message("Builing Debug...")

add_definitions(-DDEBUG)
add_link_options(-Wl,-z,max-page-size=16384)
endif ()

find_package(boringssl REQUIRED CONFIG)
Expand All @@ -23,6 +24,7 @@ find_package(cxx REQUIRED CONFIG)
add_executable(libshizuku.so
starter.cpp misc.cpp selinux.cpp cgroup.cpp)

target_link_options(libshizuku.so PRIVATE -Wl,-z,max-page-size=16384)
target_link_libraries(libshizuku.so log cxx::cxx)

if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand All @@ -33,6 +35,7 @@ endif ()
add_library(adb SHARED
adb_pairing.cpp misc.cpp)

target_link_options(adb PRIVATE -Wl,-z,max-page-size=16384)
target_link_libraries(adb log boringssl::crypto_static cxx::cxx)

if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand Down
1 change: 1 addition & 0 deletions termux/termux-emulator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ android {
externalNativeBuild {
ndkBuild {
cFlags += arrayOf("-std=c11", "-Wall", "-Wextra", "-Werror", "-Os", "-fno-stack-protector", "-Wl,--gc-sections")
// Note: Linker flags for 16 KB alignment are set in Android.mk via LOCAL_LDFLAGS
}
}
}
Expand Down
1 change: 1 addition & 0 deletions termux/termux-emulator/src/main/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= libtermux
LOCAL_LDFLAGS += -Wl,-z,max-page-size=16384
LOCAL_SRC_FILES:= termux.c
include $(BUILD_SHARED_LIBRARY)
1 change: 1 addition & 0 deletions termux/termux-shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ android {
externalNativeBuild {
ndkBuild {
path = file("src/main/cpp/Android.mk")
// Note: Linker flags for 16 KB alignment are set in Android.mk via LOCAL_LDFLAGS
}
}
}
Expand Down
1 change: 1 addition & 0 deletions termux/termux-shared/src/main/cpp/Android.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -llog
LOCAL_LDFLAGS += -Wl,-z,max-page-size=16384
LOCAL_MODULE := local-socket
LOCAL_SRC_FILES := local-socket.cpp
include $(BUILD_SHARED_LIBRARY)