diff mbox series

[uclibc-ng-devel,1/2] Generalize vDSO code.

Message ID 20240416053716.874210-1-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
- 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(-)

Comments

Waldemar Brodkorb April 18, 2024, 12:57 p.m. UTC | #1
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
diff mbox series

Patch

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 */
+