- Add macroses for vDSO functions names because in some architectures these names differ from the default ones.
- Add header guards in dl-syscalls.h .
Signed-off-by: Dmitry Chestnykh dm.chestnykh@gmail.com --- ldso/ldso/arm/dl-syscalls.h | 8 +++++++- ldso/ldso/dl-vdso.c | 14 +++++++++++--- ldso/ldso/mips/dl-syscalls.h | 8 +++++++- ldso/ldso/x86_64/dl-syscalls.h | 8 +++++++- 4 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/ldso/ldso/arm/dl-syscalls.h b/ldso/ldso/arm/dl-syscalls.h index 5cbb94d30..5f6f7a883 100644 --- a/ldso/ldso/arm/dl-syscalls.h +++ b/ldso/ldso/arm/dl-syscalls.h @@ -1,5 +1,8 @@ /* stub for arch-specific syscall issues/specific implementations */
+#ifndef _DL_SYSCALLS_H +#define _DL_SYSCALLS_H + #if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO)
#include "../dl-vdso-calls.h" @@ -19,4 +22,7 @@ static int __attribute__ ((used)) __arm_vdso_gettimeofday(struct timeval *tv, __ #define ARCH_VDSO_GETTIMEOFDAY(tv, tz) __arm_vdso_gettimeofday(tv, tz) #define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __arm_vdso_clock_gettime(clock_id, tp)
-#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ \ No newline at end of file +#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ + +#endif /* _DL_SYSCALLS_H */ + diff --git a/ldso/ldso/dl-vdso.c b/ldso/ldso/dl-vdso.c index c23fd8b72..196cbbb3b 100755 --- a/ldso/ldso/dl-vdso.c +++ b/ldso/ldso/dl-vdso.c @@ -3,6 +3,14 @@ #include <string.h> #include "sys/auxv.h"
+#define __ARCH_VDSO_GETTIMEOFDAY_NAME "__vdso_gettimeofday" +#define __ARCH_VDSO_CLOCK_GETTIME_NAME "__vdso_clock_gettime" + +#if defined(__UCLIBC_USE_TIME64__) +#define __ARCH_VDSO_CLOCK_GETTIME64_NAME "__vdso_clock_gettime64" +#endif + +/* Maybe override default vDSO functions names by arch-specific */ #include "ldso.h" #include "generated/autoconf.h"
@@ -321,7 +329,7 @@ void load_vdso(void *sys_info_ehdr, char **envp ){ continue; }
- if ( 0 == _dl_strcmp( name, "__vdso_gettimeofday" ) ){ + if ( 0 == _dl_strcmp( name, __ARCH_VDSO_GETTIMEOFDAY_NAME ) ){ _dl__vdso_gettimeofday = func_addr; #ifdef __SUPPORT_LD_DEBUG__ if ( _dl_debug_vdso != 0 ){ @@ -330,7 +338,7 @@ void load_vdso(void *sys_info_ehdr, char **envp ){ #endif continue; } - if ( 0 == _dl_strcmp( name, "__vdso_clock_gettime" ) ){ + if ( 0 == _dl_strcmp( name, __ARCH_VDSO_CLOCK_GETTIME_NAME ) ){ _dl__vdso_clock_gettime = func_addr; #ifdef __SUPPORT_LD_DEBUG__ if ( _dl_debug_vdso != 0 ){ @@ -341,7 +349,7 @@ void load_vdso(void *sys_info_ehdr, char **envp ){ }
#if defined(__UCLIBC_USE_TIME64__) - if ( 0 == _dl_strcmp( name, "__vdso_clock_gettime64" ) ){ + if ( 0 == _dl_strcmp( name, __ARCH_VDSO_CLOCK_GETTIME64_NAME ) ){ _dl__vdso_clock_gettime64 = func_addr; #ifdef __SUPPORT_LD_DEBUG__ if ( _dl_debug_vdso != 0 ){ diff --git a/ldso/ldso/mips/dl-syscalls.h b/ldso/ldso/mips/dl-syscalls.h index 46fd07bfa..d8407f17c 100644 --- a/ldso/ldso/mips/dl-syscalls.h +++ b/ldso/ldso/mips/dl-syscalls.h @@ -1,5 +1,8 @@ /* stub for arch-specific syscall issues/specific implementations */
+#ifndef _DL_SYSCALLS_H +#define _DL_SYSCALLS_H + #if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO)
#include "../dl-vdso-calls.h" @@ -19,4 +22,7 @@ static int __attribute__ ((used)) __mips_vdso_gettimeofday(struct timeval *tv, _ #define ARCH_VDSO_GETTIMEOFDAY(tv, tz) __mips_vdso_gettimeofday(tv, tz) #define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __mips_vdso_clock_gettime(clock_id, tp)
-#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ \ No newline at end of file +#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ + +#endif /* _DL_SYSCALLS_H */ + diff --git a/ldso/ldso/x86_64/dl-syscalls.h b/ldso/ldso/x86_64/dl-syscalls.h index 0ec7a7dbb..3f953aa83 100644 --- a/ldso/ldso/x86_64/dl-syscalls.h +++ b/ldso/ldso/x86_64/dl-syscalls.h @@ -1,5 +1,8 @@ /* stub for arch-specific syscall issues/specific implementations */
+#ifndef _DL_SYSCALLS_H +#define _DL_SYSCALLS_H + #if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO)
#include "../dl-vdso-calls.h" @@ -19,4 +22,7 @@ static int __attribute__ ((used)) __x86_64_vdso_gettimeofday(struct timeval *tv, #define ARCH_VDSO_GETTIMEOFDAY(tv, tz) __x86_64_vdso_gettimeofday(tv, tz) #define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __x86_64_vdso_clock_gettime(clock_id, tp)
-#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ \ No newline at end of file +#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ + +#endif /* _DL_SYSCALLS_H */ +
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(-)
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 */ +
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
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
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.
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=133909a8e052d8b...
No other issues are known.
best regards Waldemar
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... ) 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=133909a8e052d8b...
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
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=67918f2bc3c4794... [2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=5b89fd74e7e9075...
thanks, Lance _______________________________________________ devel mailing list -- devel@uclibc-ng.org To unsubscribe send an email to devel-leave@uclibc-ng.org
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
Hi Dmitry, Dmitry Chestnykh wrote,
Add macroses for vDSO functions names because in some architectures these names differ from the default ones.
Add header guards in dl-syscalls.h .
Signed-off-by: Dmitry Chestnykh dm.chestnykh@gmail.com
Applied and pushed, Thanks Waldemar