diff --git a/build.py b/build.py index 6ffcb3c62..7a29de90e 100755 --- a/build.py +++ b/build.py @@ -556,27 +556,6 @@ def setup_ndk(args): rm_rf(ndk_path) mv(ondk_path, ndk_path) - header("* Patching static libs") - for target in ["arm-linux-androideabi", "i686-linux-android"]: - arch = target.split("-")[0] - lib_dir = op.join( - ndk_path, - "toolchains", - "llvm", - "prebuilt", - f"{os_name}-x86_64", - "sysroot", - "usr", - "lib", - f"{target}", - "23", - ) - if not op.exists(lib_dir): - continue - src_dir = op.join("tools", "ndk-bins", arch) - rm(op.join(src_dir, ".DS_Store")) - shutil.copytree(src_dir, lib_dir, copy_function=cp, dirs_exist_ok=True) - def push_files(args, script): abi = cmd_out([adb_path, "shell", "getprop", "ro.product.cpu.abi"]) diff --git a/native/src/Android.mk b/native/src/Android.mk index 47c204955..20b9c3084 100644 --- a/native/src/Android.mk +++ b/native/src/Android.mk @@ -76,12 +76,13 @@ LOCAL_SRC_FILES := \ init/selinux.cpp \ init/init-rs.cpp -LOCAL_LDFLAGS := -static +LOCAL_LDFLAGS := -static -T src/lto_fix.lds ifdef B_CRT0 # -lc -lm is hardcoded in this variable, disable it TARGET_LDLIBS := LOCAL_STATIC_LIBRARIES += crt0 +LOCAL_LDFLAGS := endif include $(BUILD_EXECUTABLE) @@ -108,6 +109,8 @@ LOCAL_SRC_FILES := \ boot/format.cpp \ boot/boot-rs.cpp +LOCAL_LDFLAGS := -static -T src/lto_fix.lds + include $(BUILD_EXECUTABLE) endif diff --git a/native/src/Application.mk b/native/src/Application.mk index 0e78996ef..d0123ed47 100644 --- a/native/src/Application.mk +++ b/native/src/Application.mk @@ -4,7 +4,7 @@ APP_CFLAGS := -Wall -Oz -fomit-frame-pointer -flto APP_LDFLAGS := -flto APP_CPPFLAGS := -std=c++20 APP_STL := none -APP_PLATFORM := android-26 +APP_PLATFORM := android-23 APP_THIN_ARCHIVE := true APP_STRIP_MODE := none