mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
Make all platforms build properly
This commit is contained in:
parent
66f49dfab5
commit
0dbaf52566
1
build.py
1
build.py
@ -241,7 +241,6 @@ def clean_elf():
|
||||
def run_ndk_build(flags):
|
||||
os.chdir("native")
|
||||
flags = "NDK_PROJECT_PATH=. NDK_APPLICATION_MK=src/Application.mk " + flags
|
||||
cpu_count = 1
|
||||
proc = system(f"{ndk_build} {flags} -j{cpu_count}")
|
||||
if proc.returncode != 0:
|
||||
error("Build binary failed!")
|
||||
|
@ -27,25 +27,18 @@ ENTRY(syscall)
|
||||
.cfi_adjust_cfa_offset 4
|
||||
.cfi_rel_offset ebp, 0
|
||||
|
||||
# Get and save the system call entry address.
|
||||
call __kernel_syscall
|
||||
push %eax
|
||||
.cfi_adjust_cfa_offset 4
|
||||
.cfi_rel_offset eax, 0
|
||||
|
||||
# Load all the arguments from the calling frame.
|
||||
# (Not all will be valid, depending on the syscall.)
|
||||
mov 24(%esp),%eax
|
||||
mov 28(%esp),%ebx
|
||||
mov 32(%esp),%ecx
|
||||
mov 36(%esp),%edx
|
||||
mov 40(%esp),%esi
|
||||
mov 44(%esp),%edi
|
||||
mov 48(%esp),%ebp
|
||||
mov 20(%esp),%eax
|
||||
mov 24(%esp),%ebx
|
||||
mov 28(%esp),%ecx
|
||||
mov 32(%esp),%edx
|
||||
mov 36(%esp),%esi
|
||||
mov 40(%esp),%edi
|
||||
mov 44(%esp),%ebp
|
||||
|
||||
# Make the system call.
|
||||
call *(%esp)
|
||||
addl $4, %esp
|
||||
int $0x80
|
||||
|
||||
# Error?
|
||||
cmpl $-MAX_ERRNO, %eax
|
||||
|
@ -1,6 +1,14 @@
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
void *memset(void *dst, int ch, size_t n) {
|
||||
return __builtin_memset(dst, ch, n);
|
||||
}
|
||||
|
||||
void *memmove(void *dst, const void *src, size_t n) {
|
||||
return __builtin_memmove(dst, src, n);
|
||||
}
|
||||
|
||||
void *memcpy(void *dst, const void *src, size_t size) {
|
||||
return __builtin_memcpy(dst, src, size);
|
||||
}
|
||||
|
@ -161,3 +161,23 @@ void __wrap_abort_message(const char* format, ...) {
|
||||
int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Dummy function symbols
|
||||
|
||||
long dummy() { return 0; }
|
||||
|
||||
#define DUMMY_SYMBOL(name) \
|
||||
__asm__(".global " #name " \n " #name " = dummy")
|
||||
|
||||
DUMMY_SYMBOL(pthread_setspecific);
|
||||
DUMMY_SYMBOL(pthread_key_create);
|
||||
DUMMY_SYMBOL(pthread_key_delete);
|
||||
DUMMY_SYMBOL(pthread_getspecific);
|
||||
|
||||
// Workaround LTO bug: https://github.com/llvm/llvm-project/issues/61101
|
||||
#if defined(__i386__)
|
||||
extern long *_GLOBAL_OFFSET_TABLE_;
|
||||
long unused() {
|
||||
return *_GLOBAL_OFFSET_TABLE_;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user