Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
d3d28f06
Commit
d3d28f06
authored
Jan 30, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to NDK r23b
Credits: @yujincheng08 Close #5193
parent
f880b575
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
27 deletions
+55
-27
build.py
build.py
+2
-2
gradle.properties
gradle.properties
+2
-2
Application.mk
native/jni/Application.mk
+6
-3
busybox
native/jni/external/busybox
+1
-1
libcxx
native/jni/external/libcxx
+1
-1
prop_area.cpp
native/jni/external/systemproperties/prop_area.cpp
+4
-4
twostage.cpp
native/jni/init/twostage.cpp
+0
-8
lto_fix.lds
native/jni/lto_fix.lds
+12
-0
misc.hpp
native/jni/utils/misc.hpp
+1
-1
missing.cpp
native/jni/utils/missing.cpp
+26
-5
No files found.
build.py
View file @
d3d28f06
...
@@ -405,7 +405,7 @@ def cleanup(args):
...
@@ -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):
...
@@ -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
)
...
...
gradle.properties
View file @
d3d28f06
...
@@ -29,5 +29,5 @@ android.nonTransitiveRClass=true
...
@@ -29,5 +29,5 @@ android.nonTransitiveRClass=true
# Magisk
# Magisk
magisk.stubVersion
=
24
magisk.stubVersion
=
24
magisk.versionCode
=
24101
magisk.versionCode
=
24101
magisk.ndkVersion
=
2
1e
magisk.ndkVersion
=
2
3b
magisk.fullNdkVersion
=
2
1.4.7075529
magisk.fullNdkVersion
=
2
3.1.7779620
native/jni/Application.mk
View file @
d3d28f06
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
...
@@ -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-2
2
APP_PLATFORM := android-2
4
ifeq ($(OS),Windows_NT)
ifeq ($(OS),Windows_NT)
APP_SHORT_COMMANDS := true
APP_SHORT_COMMANDS := true
endif
endif
...
...
busybox
@
e68ef092
Subproject commit
c4f0c98aeb9902aff5104a7519261022709d26a5
Subproject commit
e68ef0927385fb72a3fd414e206f915f4517b79f
libcxx
@
0aa67c3f
Subproject commit
b74fd5905f1064c1a33b213fca58b45441651ad1
Subproject commit
0aa67c3ffea069bdb58fe3b5e7aad06934afb292
native/jni/external/systemproperties/prop_area.cpp
View file @
d3d28f06
...
@@ -384,21 +384,21 @@ bool prop_area::prune_node(prop_bt * const node) {
...
@@ -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
,
0
u
,
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
,
0
u
,
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
,
0
u
,
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) {
...
@@ -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
,
0
u
,
memory_order_release
);
if
(
info
)
{
if
(
info
)
{
// Wipe out the old info
// Wipe out the old info
...
...
native/jni/init/twostage.cpp
View file @
d3d28f06
// 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>
...
...
native/jni/lto_fix.lds
0 → 100644
View file @
d3d28f06
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;
native/jni/utils/misc.hpp
View file @
d3d28f06
...
@@ -175,8 +175,8 @@ template <class ...Args>
...
@@ -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
);
}
}
native/jni/utils/missing.cpp
View file @
d3d28f06
...
@@ -10,8 +10,8 @@
...
@@ -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) {
...
@@ -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) {
...
@@ -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"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment