Skip to content

Commit

Permalink
experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxython committed Dec 26, 2023
1 parent 31cb34b commit 24496e0
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 29 deletions.
10 changes: 9 additions & 1 deletion gpkg/glibc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions gpkg/glibc/dl-execstack.c.dis

This file was deleted.

13 changes: 0 additions & 13 deletions gpkg/glibc/dl-load.c.dis

This file was deleted.

File renamed without changes.
10 changes: 10 additions & 0 deletions gpkg/glibc/misc-Makefile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- glibc-2.38/misc/Makefile 2023-07-31 20:54:16.000000000 +0300
+++ glibc-2.38/misc/Makefile.patch 2023-12-26 00:08:33.550537534 +0300
@@ -192,6 +192,7 @@
swapon \
sync \
syncfs \
+ syscallS \
syscall \
syslog \
truncate \
68 changes: 68 additions & 0 deletions gpkg/glibc/syscall.S.patch
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 14 additions & 1 deletion gpkg/glibc/syscall.c.patch
Original file line number Diff line number Diff line change
@@ -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 <stdarg.h>
Expand All @@ -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);
}
10 changes: 10 additions & 0 deletions gpkg/glibc/unistd.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- glibc-2.38/posix/unistd.h 2023-07-31 20:54:16.000000000 +0300
+++ glibc-2.38/posix/unistd.h.patch 2023-12-26 11:16:26.077614803 +0300
@@ -1088,6 +1088,7 @@

In Mach, all system calls take normal arguments and always return an
error code (zero for success). */
+extern long int syscallS (long int __sysno, ...) __THROW;
extern long int syscall (long int __sysno, ...) __THROW;

#endif /* Use misc. */

0 comments on commit 24496e0

Please sign in to comment.