From a74fb12d63f34a50e5865f9f44f965164edde63c Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Mon, 15 Jan 2024 04:31:35 +0800 Subject: [PATCH] liblol: glibc: also export ___brk_addr --- ...0001-add-old-world-abi-compatibility.patch | 2 +- .../patches/glibc/0002-add-sigset-ops.patch | 2 +- .../glibc/0003-add-signal-functions.patch | 2 +- .../0004-add-sigaction-ucontext-compat.patch | 2 +- ...dd-stubs-for-signal-related-io-funcs.patch | 2 +- ...006-add-syscall-fallback-for-stat-at.patch | 2 +- .../glibc/0007-add-more-pthread-symbols.patch | 2 +- ...ove-clone3-for-compatibility-with-qq.patch | 33 ++++++++++--------- .../0009-able-to-prepend-trusted-dirs.patch | 4 +-- .../glibc/0010-Add-___brk_addr-symbol.patch | 28 ++++++++++++++++ autobuild/patches/glibc/series | 1 + 11 files changed, 56 insertions(+), 24 deletions(-) create mode 100644 autobuild/patches/glibc/0010-Add-___brk_addr-symbol.patch diff --git a/autobuild/patches/glibc/0001-add-old-world-abi-compatibility.patch b/autobuild/patches/glibc/0001-add-old-world-abi-compatibility.patch index 1a84244..3f99bbe 100644 --- a/autobuild/patches/glibc/0001-add-old-world-abi-compatibility.patch +++ b/autobuild/patches/glibc/0001-add-old-world-abi-compatibility.patch @@ -1,7 +1,7 @@ From e6d58b5366ca272021d357dbda1c530f3dd25eab Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sat, 13 Jan 2024 03:23:48 +0800 -Subject: [PATCH 1/9] add old world abi compatibility +Subject: [PATCH 01/10] add old world abi compatibility --- nptl/Versions | 261 ++++++++++++++++++ diff --git a/autobuild/patches/glibc/0002-add-sigset-ops.patch b/autobuild/patches/glibc/0002-add-sigset-ops.patch index 84926dd..d931eaa 100644 --- a/autobuild/patches/glibc/0002-add-sigset-ops.patch +++ b/autobuild/patches/glibc/0002-add-sigset-ops.patch @@ -1,7 +1,7 @@ From 28b88a89b987cccc6a39cf13cc8d0d11d10207c9 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sat, 13 Jan 2024 05:07:19 +0800 -Subject: [PATCH 2/9] add sigset ops +Subject: [PATCH 02/10] add sigset ops --- sysdeps/unix/sysv/linux/loongarch/Makefile | 13 +++++++++++++ diff --git a/autobuild/patches/glibc/0003-add-signal-functions.patch b/autobuild/patches/glibc/0003-add-signal-functions.patch index 13633b9..c8559bd 100644 --- a/autobuild/patches/glibc/0003-add-signal-functions.patch +++ b/autobuild/patches/glibc/0003-add-signal-functions.patch @@ -1,7 +1,7 @@ From 3d0e1f810d7b069688995499b00c191769de3ba8 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sat, 13 Jan 2024 06:35:35 +0800 -Subject: [PATCH 3/9] add signal functions +Subject: [PATCH 03/10] add signal functions --- sysdeps/loongarch/nptl/pthread_sigmask.c | 73 +++++++++++++++++++ diff --git a/autobuild/patches/glibc/0004-add-sigaction-ucontext-compat.patch b/autobuild/patches/glibc/0004-add-sigaction-ucontext-compat.patch index afdb2c4..daf1163 100644 --- a/autobuild/patches/glibc/0004-add-sigaction-ucontext-compat.patch +++ b/autobuild/patches/glibc/0004-add-sigaction-ucontext-compat.patch @@ -1,7 +1,7 @@ From dc24dd030ab8c9a5200d11d1a66e4b038c2f0c03 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sun, 14 Jan 2024 05:15:07 +0800 -Subject: [PATCH 4/9] add sigaction & ucontext compat +Subject: [PATCH 04/10] add sigaction & ucontext compat --- sysdeps/unix/sysv/linux/loongarch/Makefile | 8 +- diff --git a/autobuild/patches/glibc/0005-add-stubs-for-signal-related-io-funcs.patch b/autobuild/patches/glibc/0005-add-stubs-for-signal-related-io-funcs.patch index d8e5707..861b4ad 100644 --- a/autobuild/patches/glibc/0005-add-stubs-for-signal-related-io-funcs.patch +++ b/autobuild/patches/glibc/0005-add-stubs-for-signal-related-io-funcs.patch @@ -1,7 +1,7 @@ From 3117d391980e8406789cef2cfe09b0c852991869 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sat, 13 Jan 2024 07:38:04 +0800 -Subject: [PATCH 5/9] add stubs for signal related io funcs +Subject: [PATCH 05/10] add stubs for signal related io funcs --- sysdeps/unix/sysv/linux/loongarch/epoll_pwait.c | 1 + diff --git a/autobuild/patches/glibc/0006-add-syscall-fallback-for-stat-at.patch b/autobuild/patches/glibc/0006-add-syscall-fallback-for-stat-at.patch index 99c931e..8c6b9bc 100644 --- a/autobuild/patches/glibc/0006-add-syscall-fallback-for-stat-at.patch +++ b/autobuild/patches/glibc/0006-add-syscall-fallback-for-stat-at.patch @@ -1,7 +1,7 @@ From 00b87a67cd5fceafe6117fe7aaac0fb458b61150 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sun, 14 Jan 2024 15:51:49 +0800 -Subject: [PATCH 6/9] add syscall fallback for *stat(at)? +Subject: [PATCH 06/10] add syscall fallback for *stat(at)? --- sysdeps/unix/sysv/linux/loongarch/fxstat64.c | 67 ++++++++++++++++ diff --git a/autobuild/patches/glibc/0007-add-more-pthread-symbols.patch b/autobuild/patches/glibc/0007-add-more-pthread-symbols.patch index 1dd5720..ca12f54 100644 --- a/autobuild/patches/glibc/0007-add-more-pthread-symbols.patch +++ b/autobuild/patches/glibc/0007-add-more-pthread-symbols.patch @@ -1,7 +1,7 @@ From a021f7f41b009bb07fe6a0cbadcb99118cca937a Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sun, 14 Jan 2024 08:41:15 +0800 -Subject: [PATCH 7/9] add more pthread symbols +Subject: [PATCH 07/10] add more pthread symbols --- nptl/old_pthread_cond_destroy.c | 4 ++-- diff --git a/autobuild/patches/glibc/0008-remove-clone3-for-compatibility-with-qq.patch b/autobuild/patches/glibc/0008-remove-clone3-for-compatibility-with-qq.patch index 3fdbbb4..0cdb1bc 100644 --- a/autobuild/patches/glibc/0008-remove-clone3-for-compatibility-with-qq.patch +++ b/autobuild/patches/glibc/0008-remove-clone3-for-compatibility-with-qq.patch @@ -1,24 +1,27 @@ -From f514ec845f07b3d6e5e329a64783438a11f1291d Mon Sep 17 00:00:00 2001 +From e766883c29709df46d9a67e2e2896756dee31cb5 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sun, 14 Jan 2024 16:51:44 +0800 -Subject: [PATCH 8/9] remove clone3 for compatibility with qq +Subject: [PATCH 08/10] remove clone3 for compatibility with qq --- - sysdeps/unix/sysv/linux/loongarch/sysdep.h | 1 + - 1 file changed, 1 insertion(+) + sysdeps/unix/sysv/linux/loongarch/clone-internal.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + create mode 100644 sysdeps/unix/sysv/linux/loongarch/clone-internal.c -diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h -index e11cd865ce..5c532ecdff 100644 ---- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h -+++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h -@@ -121,6 +121,7 @@ - #define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" - - #define HAVE_CLONE3_WRAPPER 1 +diff --git a/sysdeps/unix/sysv/linux/loongarch/clone-internal.c b/sysdeps/unix/sysv/linux/loongarch/clone-internal.c +new file mode 100644 +index 0000000000..e01ce980bc +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/loongarch/clone-internal.c +@@ -0,0 +1,8 @@ ++#include ++ ++#if LIB_COMPAT(libc, GLIBC_2_27, GLIBC_2_36) ++#include +#undef HAVE_CLONE3_WRAPPER - - #define INTERNAL_SYSCALL(name, nr, args...) \ - internal_syscall##nr (SYS_ify (name), args) ++#endif ++ ++#include -- 2.39.0 diff --git a/autobuild/patches/glibc/0009-able-to-prepend-trusted-dirs.patch b/autobuild/patches/glibc/0009-able-to-prepend-trusted-dirs.patch index e694a1f..178e148 100644 --- a/autobuild/patches/glibc/0009-able-to-prepend-trusted-dirs.patch +++ b/autobuild/patches/glibc/0009-able-to-prepend-trusted-dirs.patch @@ -1,7 +1,7 @@ -From 448b6b9c8ee7cc340aafac9e60502147444fb939 Mon Sep 17 00:00:00 2001 +From 8d5b7202db61545872a880abd0c9a3dc012b20b3 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sun, 14 Jan 2024 13:28:41 +0800 -Subject: [PATCH 9/9] able to prepend trusted-dirs +Subject: [PATCH 09/10] able to prepend trusted-dirs --- elf/Makefile | 2 +- diff --git a/autobuild/patches/glibc/0010-Add-___brk_addr-symbol.patch b/autobuild/patches/glibc/0010-Add-___brk_addr-symbol.patch new file mode 100644 index 0000000..1215375 --- /dev/null +++ b/autobuild/patches/glibc/0010-Add-___brk_addr-symbol.patch @@ -0,0 +1,28 @@ +From c2ef1e7fe9b5c0cec43197e440cc5b4a05bbde24 Mon Sep 17 00:00:00 2001 +From: Miao Wang +Date: Mon, 15 Jan 2024 04:16:47 +0800 +Subject: [PATCH 10/10] Add ___brk_addr symbol + +--- + sysdeps/unix/sysv/linux/loongarch/brk.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + create mode 100644 sysdeps/unix/sysv/linux/loongarch/brk.c + +diff --git a/sysdeps/unix/sysv/linux/loongarch/brk.c b/sysdeps/unix/sysv/linux/loongarch/brk.c +new file mode 100644 +index 0000000000..82c285f452 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/loongarch/brk.c +@@ -0,0 +1,9 @@ ++#include ++ ++#if LIB_COMPAT(libc, GLIBC_2_27, GLIBC_2_36) ++#include ++#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL ++#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 ++#endif ++ ++#include +-- +2.39.0 + diff --git a/autobuild/patches/glibc/series b/autobuild/patches/glibc/series index 4144d44..d9af22e 100644 --- a/autobuild/patches/glibc/series +++ b/autobuild/patches/glibc/series @@ -7,3 +7,4 @@ 0007-add-more-pthread-symbols.patch 0008-remove-clone3-for-compatibility-with-qq.patch 0009-able-to-prepend-trusted-dirs.patch +0010-Add-___brk_addr-symbol.patch