mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
parent
f880b57544
commit
d3d28f0623
4
build.py
4
build.py
@ -405,7 +405,7 @@ def cleanup(args):
|
|||||||
def setup_ndk(args):
|
def setup_ndk(args):
|
||||||
os_name = platform.system().lower()
|
os_name = platform.system().lower()
|
||||||
ndk_ver = config['ndkVersion']
|
ndk_ver = config['ndkVersion']
|
||||||
url = f'https://dl.google.com/android/repository/android-ndk-r{ndk_ver}-{os_name}-x86_64.zip'
|
url = f'https://dl.google.com/android/repository/android-ndk-r{ndk_ver}-{os_name}.zip'
|
||||||
ndk_zip = url.split('/')[-1]
|
ndk_zip = url.split('/')[-1]
|
||||||
|
|
||||||
header(f'* Downloading {ndk_zip}')
|
header(f'* Downloading {ndk_zip}')
|
||||||
@ -417,7 +417,7 @@ def setup_ndk(args):
|
|||||||
with zipfile.ZipFile(ndk_zip, 'r') as zf:
|
with zipfile.ZipFile(ndk_zip, 'r') as zf:
|
||||||
for info in zf.infolist():
|
for info in zf.infolist():
|
||||||
vprint(f'Extracting {info.filename}')
|
vprint(f'Extracting {info.filename}')
|
||||||
if info.external_attr == 2716663808: # symlink
|
if info.external_attr >> 28 == 0xA: # symlink
|
||||||
src = zf.read(info).decode("utf-8")
|
src = zf.read(info).decode("utf-8")
|
||||||
dest = op.join(ndk_root, info.filename)
|
dest = op.join(ndk_root, info.filename)
|
||||||
os.symlink(src, dest)
|
os.symlink(src, dest)
|
||||||
|
@ -29,5 +29,5 @@ android.nonTransitiveRClass=true
|
|||||||
# Magisk
|
# Magisk
|
||||||
magisk.stubVersion=24
|
magisk.stubVersion=24
|
||||||
magisk.versionCode=24101
|
magisk.versionCode=24101
|
||||||
magisk.ndkVersion=21e
|
magisk.ndkVersion=23b
|
||||||
magisk.fullNdkVersion=21.4.7075529
|
magisk.fullNdkVersion=23.1.7779620
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
|
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
|
||||||
APP_CFLAGS := -Wall -Oz -fomit-frame-pointer -flto
|
APP_CFLAGS := -Wall -Oz -fomit-frame-pointer -flto
|
||||||
APP_LDFLAGS := -flto
|
APP_LDFLAGS := -flto
|
||||||
APP_CPPFLAGS := -std=c++17
|
APP_CPPFLAGS := -std=c++20
|
||||||
APP_STL := none
|
APP_STL := none
|
||||||
APP_PLATFORM := android-21
|
APP_PLATFORM := android-21
|
||||||
APP_THIN_ARCHIVE := true
|
APP_THIN_ARCHIVE := true
|
||||||
APP_STRIP_MODE := --strip-all
|
APP_STRIP_MODE := --strip-all
|
||||||
|
|
||||||
|
ifndef B_SHARED
|
||||||
|
# Fix static variables' ctor/dtor when using LTO
|
||||||
|
# See: https://github.com/android/ndk/issues/1461
|
||||||
|
APP_LDFLAGS += -T jni/lto_fix.lds
|
||||||
ifneq ($(TARGET_ARCH),arm64)
|
ifneq ($(TARGET_ARCH),arm64)
|
||||||
ifneq ($(TARGET_ARCH),x86_64)
|
ifneq ($(TARGET_ARCH),x86_64)
|
||||||
ifndef B_SHARED
|
|
||||||
# Disable fortify on static 32-bit targets
|
# Disable fortify on static 32-bit targets
|
||||||
APP_CFLAGS += -D_FORTIFY_SOURCE=0 -Wno-macro-redefined
|
APP_CFLAGS += -D_FORTIFY_SOURCE=0 -Wno-macro-redefined
|
||||||
endif
|
endif
|
||||||
@ -18,7 +21,7 @@ endif
|
|||||||
|
|
||||||
# Busybox should use stock libc.a
|
# Busybox should use stock libc.a
|
||||||
ifdef B_BB
|
ifdef B_BB
|
||||||
APP_PLATFORM := android-22
|
APP_PLATFORM := android-24
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
APP_SHORT_COMMANDS := true
|
APP_SHORT_COMMANDS := true
|
||||||
endif
|
endif
|
||||||
|
2
native/jni/external/busybox
vendored
2
native/jni/external/busybox
vendored
@ -1 +1 @@
|
|||||||
Subproject commit c4f0c98aeb9902aff5104a7519261022709d26a5
|
Subproject commit e68ef0927385fb72a3fd414e206f915f4517b79f
|
2
native/jni/external/libcxx
vendored
2
native/jni/external/libcxx
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b74fd5905f1064c1a33b213fca58b45441651ad1
|
Subproject commit 0aa67c3ffea069bdb58fe3b5e7aad06934afb292
|
@ -384,21 +384,21 @@ bool prop_area::prune_node(prop_bt * const node) {
|
|||||||
bool is_leaf = true;
|
bool is_leaf = true;
|
||||||
if (atomic_load_explicit(&node->children, memory_order_relaxed) != 0) {
|
if (atomic_load_explicit(&node->children, memory_order_relaxed) != 0) {
|
||||||
if (prune_node(to_prop_bt(&node->children))) {
|
if (prune_node(to_prop_bt(&node->children))) {
|
||||||
atomic_store_explicit(&node->children, 0, memory_order_release);
|
atomic_store_explicit(&node->children, 0u, memory_order_release);
|
||||||
} else {
|
} else {
|
||||||
is_leaf = false;
|
is_leaf = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (atomic_load_explicit(&node->left, memory_order_relaxed) != 0) {
|
if (atomic_load_explicit(&node->left, memory_order_relaxed) != 0) {
|
||||||
if (prune_node(to_prop_bt(&node->left))) {
|
if (prune_node(to_prop_bt(&node->left))) {
|
||||||
atomic_store_explicit(&node->left, 0, memory_order_release);
|
atomic_store_explicit(&node->left, 0u, memory_order_release);
|
||||||
} else {
|
} else {
|
||||||
is_leaf = false;
|
is_leaf = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (atomic_load_explicit(&node->right, memory_order_relaxed) != 0) {
|
if (atomic_load_explicit(&node->right, memory_order_relaxed) != 0) {
|
||||||
if (prune_node(to_prop_bt(&node->right))) {
|
if (prune_node(to_prop_bt(&node->right))) {
|
||||||
atomic_store_explicit(&node->right, 0, memory_order_release);
|
atomic_store_explicit(&node->right, 0u, memory_order_release);
|
||||||
} else {
|
} else {
|
||||||
is_leaf = false;
|
is_leaf = false;
|
||||||
}
|
}
|
||||||
@ -425,7 +425,7 @@ bool prop_area::rm(const char *name, bool trim_node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// De-reference the existing property ASAP
|
// De-reference the existing property ASAP
|
||||||
atomic_store_explicit(&node->prop, 0, memory_order_release);
|
atomic_store_explicit(&node->prop, 0u, memory_order_release);
|
||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
// Wipe out the old info
|
// Wipe out the old info
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
// Force using legacy_signal_inlines.h
|
|
||||||
#define __ANDROID_API_BACKUP__ __ANDROID_API__
|
|
||||||
#undef __ANDROID_API__
|
|
||||||
#define __ANDROID_API__ 20
|
|
||||||
#include <android/legacy_signal_inlines.h>
|
|
||||||
#undef __ANDROID_API__
|
|
||||||
#define __ANDROID_API__ __ANDROID_API_BACKUP__
|
|
||||||
|
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
12
native/jni/lto_fix.lds
Normal file
12
native/jni/lto_fix.lds
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
SECTIONS {
|
||||||
|
.init_array : {
|
||||||
|
*(SORT_BY_INIT_PRIORITY(.init_array.*))
|
||||||
|
*(EXCLUDE_FILE(*crtend_android.o) .init_array)
|
||||||
|
}
|
||||||
|
} INSERT AFTER .fini_array;
|
||||||
|
SECTIONS {
|
||||||
|
.fini_array : {
|
||||||
|
*(SORT_BY_INIT_PRIORITY(.fini_array.*))
|
||||||
|
*(EXCLUDE_FILE(*crtend_android.o) .fini_array)
|
||||||
|
}
|
||||||
|
} INSERT BEFORE .init_array;
|
@ -175,8 +175,8 @@ template <class ...Args>
|
|||||||
void exec_command_async(Args &&...args) {
|
void exec_command_async(Args &&...args) {
|
||||||
const char *argv[] = {args..., nullptr};
|
const char *argv[] = {args..., nullptr};
|
||||||
exec_t exec {
|
exec_t exec {
|
||||||
|
.fork = fork_dont_care,
|
||||||
.argv = argv,
|
.argv = argv,
|
||||||
.fork = fork_dont_care
|
|
||||||
};
|
};
|
||||||
exec_command(exec);
|
exec_command(exec);
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
/* Original source: https://github.com/freebsd/freebsd/blob/master/contrib/file/src/getline.c
|
// Original source: https://github.com/freebsd/freebsd/blob/master/contrib/file/src/getline.c
|
||||||
* License: BSD, full copyright notice please check original source */
|
// License: BSD, full copyright notice please check original source
|
||||||
|
|
||||||
ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) {
|
ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) {
|
||||||
char *ptr, *eptr;
|
char *ptr, *eptr;
|
||||||
@ -53,8 +53,8 @@ ssize_t getline(char **buf, size_t *bufsiz, FILE *fp) {
|
|||||||
return getdelim(buf, bufsiz, '\n', fp);
|
return getdelim(buf, bufsiz, '\n', fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Original source: https://android.googlesource.com/platform/bionic/+/master/libc/bionic/mntent.cpp
|
// Original source: https://android.googlesource.com/platform/bionic/+/master/libc/bionic/mntent.cpp
|
||||||
* License: AOSP, full copyright notice please check original source */
|
// License: AOSP, full copyright notice please check original source
|
||||||
|
|
||||||
struct mntent *getmntent_r(FILE *fp, struct mntent *e, char *buf, int buf_len) {
|
struct mntent *getmntent_r(FILE *fp, struct mntent *e, char *buf, int buf_len) {
|
||||||
memset(e, 0, sizeof(*e));
|
memset(e, 0, sizeof(*e));
|
||||||
@ -143,7 +143,28 @@ int ftruncate64(int fd, off64_t length) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__LP64__)
|
#if !defined(__LP64__)
|
||||||
void android_set_abort_message(const char *msg) {}
|
void android_set_abort_message(const char *) {}
|
||||||
|
|
||||||
|
// Original source: <android/legacy_signal_inlines.h>
|
||||||
|
int sigaddset(sigset_t *set, int signum) {
|
||||||
|
/* Signal numbers start at 1, but bit positions start at 0. */
|
||||||
|
int bit = signum - 1;
|
||||||
|
auto *local_set = (unsigned long *)set;
|
||||||
|
if (set == nullptr || bit < 0 || bit >= (int)(8 * sizeof(sigset_t))) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
local_set[bit / LONG_BIT] |= 1UL << (bit % LONG_BIT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int sigemptyset(sigset_t *set) {
|
||||||
|
if (set == nullptr) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
memset(set, 0, sizeof(sigset_t));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user