diff mbox series

[uclibc-ng-devel,2/2] Add vDSO support for aarch64.

Message ID 20240416053716.874210-2-dm.chestnykh@gmail.com
State Accepted
Headers show
Series [uclibc-ng-devel,1/2] Generalize vDSO code. | expand

Commit Message

Dmitry Chestnykh April 16, 2024, 5:37 a.m. UTC
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
---
 extra/Configs/Config.aarch64    |  1 +
 ldso/ldso/aarch64/dl-syscalls.h | 39 ++++++++++++++++++++++++++++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)

Comments

Lance Fredrickson April 16, 2024, 8:43 p.m. UTC | #1
Seeing the changes for aarch64 and vdso reminded me to ask, what's the 
current state of aarch64 and uclibc-ng? Last I checked in August 2022 it 
was still critically broken. These were some of the relevant emails I 
found at the time.

https://www.mail-archive.com/devel@uclibc-ng.org/msg00953.html
https://www.mail-archive.com/devel@uclibc-ng.org/msg00871.html

thanks,
Lance
Dmitry Chestnykh April 17, 2024, 3:10 a.m. UTC | #2
I was able to build minimal qemu buildroot aarch64 config and run it, the
system successfully started and ssh worked

вт, 16 апр. 2024 г., 23:44 Lance Fredrickson <lancethepants@gmail.com>:

> Seeing the changes for aarch64 and vdso reminded me to ask, what's the
> current state of aarch64 and uclibc-ng? Last I checked in August 2022 it
> was still critically broken. These were some of the relevant emails I
> found at the time.
>
> https://www.mail-archive.com/devel@uclibc-ng.org/msg00953.html
> https://www.mail-archive.com/devel@uclibc-ng.org/msg00871.html
>
> thanks,
> Lance
> _______________________________________________
> devel mailing list -- devel@uclibc-ng.org
> To unsubscribe send an email to devel-leave@uclibc-ng.org
>
Nicolas Cavallari April 17, 2024, 6:53 a.m. UTC | #3
On 17/04/2024 05:10, Dmitriy Chestnykh wrote:
> I was able to build minimal qemu buildroot aarch64 config and run it, 
> the system successfully started and ssh worked

SSH probably does not use enough thread local storage to crash.
Try ntpd or a program that makes heavy use of C++ exceptions.

IIRC, the problem is that GCC expects a different TLS scheme than uclibc 
and optimize TLS accesses depending on it. And the TLS scheme it expects 
isn't documented. But the last time I tested this was 2 years ago.
Waldemar Brodkorb April 17, 2024, 8:01 a.m. UTC | #4
Hi Lance,
Lance Fredrickson wrote,

> Seeing the changes for aarch64 and vdso reminded me to ask, what's the
> current state of aarch64 and uclibc-ng? Last I checked in August 2022 it was
> still critically broken. These were some of the relevant emails I found at
> the time.
> 
> https://www.mail-archive.com/devel@uclibc-ng.org/msg00953.html
> https://www.mail-archive.com/devel@uclibc-ng.org/msg00871.html
> 
I had issues with curl and gnutls, but they are fixed by 
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=133909a8e052d8bf6fe21d9e3dd5546d0198ac7e

No other issues are known.

best regards
 Waldemar
Dmitry Chestnykh April 17, 2024, 10:56 a.m. UTC | #5
uClibc-ng on aarch64 can't handle binaries which use TLS global-dynamic
access model because ld.so don't apply DTMOD and DTPREL relocations.
Related tests fails (
https://downloads.uclibc-ng.org/reports/1.0.47/REPORT.aarch64.libc.uClibc-ng-1.0.47
)
Now i am working on the fix of this problem.

ср, 17 апр. 2024 г. в 11:09, Waldemar Brodkorb <wbx@openadk.org>:

> Hi Lance,
> Lance Fredrickson wrote,
>
> > Seeing the changes for aarch64 and vdso reminded me to ask, what's the
> > current state of aarch64 and uclibc-ng? Last I checked in August 2022 it
> was
> > still critically broken. These were some of the relevant emails I found
> at
> > the time.
> >
> > https://www.mail-archive.com/devel@uclibc-ng.org/msg00953.html
> > https://www.mail-archive.com/devel@uclibc-ng.org/msg00871.html
> >
> I had issues with curl and gnutls, but they are fixed by
>
> https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=133909a8e052d8bf6fe21d9e3dd5546d0198ac7e
>
> No other issues are known.
>
> best regards
>  Waldemar
> _______________________________________________
> devel mailing list -- devel@uclibc-ng.org
> To unsubscribe send an email to devel-leave@uclibc-ng.org
>
Waldemar Brodkorb April 18, 2024, 12:58 p.m. UTC | #6
Hi Dmitry,
Dmitry Chestnykh wrote,

> Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
> ---
>  extra/Configs/Config.aarch64    |  1 +
>  ldso/ldso/aarch64/dl-syscalls.h | 39 ++++++++++++++++++++++++++++++++-
>  2 files changed, 39 insertions(+), 1 deletion(-)
> 
Applied and pushed,
 Thanks
  Waldemar
Peter Seiderer April 18, 2024, 1:06 p.m. UTC | #7
On Tue, 16 Apr 2024 14:43:00 -0600, Lance Fredrickson <lancethepants@gmail.com> wrote:

> Seeing the changes for aarch64 and vdso reminded me to ask, what's the
> current state of aarch64 and uclibc-ng? Last I checked in August 2022 it
> was still critically broken. These were some of the relevant emails I
> found at the time.
>
> https://www.mail-archive.com/devel@uclibc-ng.org/msg00953.html
> https://www.mail-archive.com/devel@uclibc-ng.org/msg00871.html

The ntpd/res_init problem should be fixed by "libc/inet/resolv: fix per thread
res_state access" [1] (and "fix compile for Linuxthreads enabled" [2])...

Regards,
Peter

[1] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=67918f2bc3c4794d6d7e824963e5e0002d2ef10c
[2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=5b89fd74e7e9075049f3268424ab1ee14f811b0d

>
> thanks,
> Lance
> _______________________________________________
> devel mailing list -- devel@uclibc-ng.org
> To unsubscribe send an email to devel-leave@uclibc-ng.org
diff mbox series

Patch

diff --git a/extra/Configs/Config.aarch64 b/extra/Configs/Config.aarch64
index d666cc595..6074878f2 100644
--- a/extra/Configs/Config.aarch64
+++ b/extra/Configs/Config.aarch64
@@ -13,6 +13,7 @@  config FORCE_OPTIONS_FOR_ARCH
 	select ARCH_ANY_ENDIAN
 	select ARCH_HAS_MMU
 	select ARCH_USE_MMU
+	select ARCH_VDSO_SUPPORT
 	select UCLIBC_HAS_FPU
 
 choice
diff --git a/ldso/ldso/aarch64/dl-syscalls.h b/ldso/ldso/aarch64/dl-syscalls.h
index f40c4fd31..7f3566d6b 100644
--- a/ldso/ldso/aarch64/dl-syscalls.h
+++ b/ldso/ldso/aarch64/dl-syscalls.h
@@ -1 +1,38 @@ 
-/* stub for arch-specific syscall issues */
+/* stub for arch-specific syscall issues/specific implementations */
+#ifndef _DL_SYSCALLS_H
+#define _DL_SYSCALLS_H
+
+#ifdef __ARCH_VDSO_GETTIMEOFDAY_NAME
+#undef __ARCH_VDSO_GETTIMEOFDAY_NAME
+#endif
+
+#ifdef __ARCH_VDSO_CLOCK_GETTIME_NAME
+#undef __ARCH_VDSO_CLOCK_GETTIME_NAME
+#endif
+
+#define __ARCH_VDSO_GETTIMEOFDAY_NAME  "__kernel_gettimeofday"
+#define __ARCH_VDSO_CLOCK_GETTIME_NAME "__kernel_clock_gettime"
+
+#if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO)
+
+#include "../dl-vdso-calls.h"
+
+static int __attribute__ ((used)) __aarch64_vdso_clock_gettime(clockid_t clock_id, struct timespec *tp);
+static int __attribute__ ((used)) __aarch64_vdso_clock_gettime(clockid_t clock_id, struct timespec *tp)
+{
+    return __generic_vdso_clock_gettime(clock_id, tp);
+}
+
+static int __attribute__ ((used)) __aarch64_vdso_gettimeofday(struct timeval *tv, __timezone_ptr_t tz);
+static int __attribute__ ((used)) __aarch64_vdso_gettimeofday(struct timeval *tv, __timezone_ptr_t tz)
+{
+    return __generic_vdso_gettimeofday(tv, tz);
+}
+
+#define ARCH_VDSO_GETTIMEOFDAY(tv, tz)        __aarch64_vdso_gettimeofday(tv, tz)
+#define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __aarch64_vdso_clock_gettime(clock_id, tp)
+
+#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */
+
+#endif /* _DL_SYSCALLS_H */
+