diff --git a/gpkg/glibc/build.sh b/gpkg/glibc/build.sh index 5fcdcff02..87060777d 100644 --- a/gpkg/glibc/build.sh +++ b/gpkg/glibc/build.sh @@ -21,9 +21,17 @@ termux_step_pre_configure() { done rm ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/*/clone3.S - rm ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/*/syscall.S + #rm ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/*/syscall.S rm ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/x86_64/configure* + if [ "$TERMUX_ARCH" = "i686" ]; then + mv ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/i386/syscall.S \ + ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/i386/syscallS.S + else + mv ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/${TERMUX_ARCH}/syscall.S \ + ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/${TERMUX_ARCH}/syscallS.S + fi + for i in android_passwd_group.h android_passwd_group.c android_system_user_ids.h; do cp ${TERMUX_PKG_BUILDER_DIR}/${i} ${TERMUX_PKG_SRCDIR}/nss/ done diff --git a/gpkg/glibc/dl-execstack.c.dis b/gpkg/glibc/dl-execstack.c.dis deleted file mode 100644 index d8c752329..000000000 --- a/gpkg/glibc/dl-execstack.c.dis +++ /dev/null @@ -1,14 +0,0 @@ ---- src/sysdeps/unix/sysv/linux/dl-execstack.c 2023-07-31 20:54:16.000000000 +0300 -+++ src/sysdeps/unix/sysv/linux/dl-execstack.c.patch 2023-12-25 10:12:20.634704179 +0300 -@@ -35,9 +35,10 @@ - /* This gives us the highest/lowest page that needs to be changed. */ - uintptr_t page = ((uintptr_t) *stack_endp - & -(intptr_t) GLRO(dl_pagesize)); -+ void *addr = mmap((void*)page, GLRO(dl_pagesize), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); - int result = 0; - -- if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize), -+ if (__builtin_expect (__mprotect (addr, GLRO(dl_pagesize), - __stack_prot) == 0, 1)) - goto return_success; - result = errno; diff --git a/gpkg/glibc/dl-load.c.dis b/gpkg/glibc/dl-load.c.dis deleted file mode 100644 index ee3a07738..000000000 --- a/gpkg/glibc/dl-load.c.dis +++ /dev/null @@ -1,13 +0,0 @@ ---- src/elf/dl-load.c 2023-07-31 20:54:16.000000000 +0300 -+++ src/elf/dl-load.c.patch 2023-12-24 17:48:46.238884735 +0300 -@@ -90,9 +90,7 @@ - - - int __stack_prot attribute_hidden attribute_relro --#if _STACK_GROWS_DOWN && defined PROT_GROWSDOWN -- = PROT_GROWSDOWN; --#elif _STACK_GROWS_UP && defined PROT_GROWSUP -+#if _STACK_GROWS_UP && defined PROT_GROWSUP - = PROT_GROWSUP; - #else - = 0; diff --git a/gpkg/glibc/syscall.S.patch b/gpkg/glibc/syscall.S.patch new file mode 100644 index 000000000..9956f34d0 --- /dev/null +++ b/gpkg/glibc/syscall.S.patch @@ -0,0 +1,68 @@ +--- glibc-2.38/sysdeps/unix/sysv/linux/aarch64/syscall.S 2023-07-31 20:54:16.000000000 +0300 ++++ glibc-2.38/sysdeps/unix/sysv/linux/aarch64/syscall.S.patch 2023-12-25 22:43:44.138402265 +0300 +@@ -26,7 +26,7 @@ + For kernel entry we need to move the system call nr to x8 then + load the remaining arguments to register. */ + +-ENTRY (syscall) ++ENTRY (syscallS) + uxtw x8, w0 + mov x0, x1 + mov x1, x2 +@@ -41,4 +41,4 @@ + RET + 1: + b SYSCALL_ERROR +-PSEUDO_END (syscall) ++PSEUDO_END (syscallS) +--- glibc-2.38/sysdeps/unix/sysv/linux/arm/syscall.S 2023-07-31 20:54:16.000000000 +0300 ++++ glibc-2.38/sysdeps/unix/sysv/linux/arm/syscall.S.patch 2023-12-25 22:45:38.988402221 +0300 +@@ -21,7 +21,7 @@ + implement syscall(). It won't work reliably with 64-bit arguments + (but that is true on many modern platforms). */ + +-ENTRY (syscall) ++ENTRY (syscallS) + mov ip, sp + push {r4, r5, r6, r7} + cfi_adjust_cfa_offset (16) +@@ -45,4 +45,4 @@ + it cc + RETINSTR(cc, lr) + b PLTJMP(syscall_error) +-PSEUDO_END (syscall) ++PSEUDO_END (syscallS) +--- glibc-2.38/sysdeps/unix/sysv/linux/x86_64/syscall.S 2023-07-31 20:54:16.000000000 +0300 ++++ glibc-2.38/sysdeps/unix/sysv/linux/x86_64/syscall.S.patch 2023-12-25 23:00:38.685827592 +0300 +@@ -26,7 +26,7 @@ + + + .text +-ENTRY (syscall) ++ENTRY (syscallS) + movq %rdi, %rax /* Syscall number -> rax. */ + movq %rsi, %rdi /* shift arg1 - arg5. */ + movq %rdx, %rsi +@@ -39,4 +39,4 @@ + jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */ + ret /* Return to caller. */ + +-PSEUDO_END (syscall) ++PSEUDO_END (syscallS) +--- glibc-2.38/sysdeps/unix/sysv/linux/i386/syscall.S 2023-07-31 20:54:16.000000000 +0300 ++++ glibc-2.38/sysdeps/unix/sysv/linux/i386/syscall.S.patch 2023-12-25 23:01:40.765827568 +0300 +@@ -21,7 +21,7 @@ + more information about the value -4095 used below.*/ + + .text +-ENTRY (syscall) ++ENTRY (syscallS) + + PUSHARGS_6 /* Save register contents. */ + _DOARGS_6(44) /* Load arguments. */ +@@ -32,4 +32,4 @@ + jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */ + ret /* Return to caller. */ + +-PSEUDO_END (syscall) ++PSEUDO_END (syscallS) diff --git a/gpkg/glibc/syscall.c.patch b/gpkg/glibc/syscall.c.patch index 943337397..e64330d33 100644 --- a/gpkg/glibc/syscall.c.patch +++ b/gpkg/glibc/syscall.c.patch @@ -1,5 +1,5 @@ --- src/sysdeps/unix/sysv/linux/syscall.c 2023-07-31 20:54:16.000000000 +0300 -+++ src/sysdeps/unix/sysv/linux/syscall.c.patch 2023-12-25 08:47:12.612090672 +0300 ++++ src/sysdeps/unix/sysv/linux/syscall.c.patch 2023-12-25 23:09:19.195827394 +0300 @@ -18,10 +18,14 @@ #include @@ -15,3 +15,16 @@ va_list args; va_start (args, number); +@@ -33,11 +37,5 @@ + long int a5 = va_arg (args, long int); + va_end (args); + +- long int r = INTERNAL_SYSCALL_NCS_CALL (number, a0, a1, a2, a3, a4, a5); +- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (r))) +- { +- __set_errno (-r); +- return -1; +- } +- return r; ++ return syscallS (number, a0, a1, a2, a3, a4, a5); + }