[v4,04/18] RISC-V: Add support for 32-bit vDSO calls

Message ID 387ccbf208e633784d901f01826143e2f16d5ebd.1597243100.git.alistair.francis@wdc.com
State Committed
Headers
Series glibc port for 32-bit RISC-V (RV32) |

Commit Message

Alistair Francis Aug. 12, 2020, 2:40 p.m. UTC
  ---
 sysdeps/unix/sysv/linux/riscv/sysdep.h | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
  

Comments

Maciej W. Rozycki Aug. 17, 2020, 2:10 p.m. UTC | #1
On Wed, 12 Aug 2020, Alistair Francis wrote:

> ---
>  sysdeps/unix/sysv/linux/riscv/sysdep.h | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)

 LGTM.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>

  Maciej
  
Kito Cheng Aug. 18, 2020, 1:35 a.m. UTC | #2
On Wed, Aug 12, 2020 at 10:54 PM Alistair Francis via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> ---
>  sysdeps/unix/sysv/linux/riscv/sysdep.h | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
> index 292484b303..6f26c558b1 100644
> --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
> @@ -135,13 +135,24 @@
>
>  #else
>
> -# define VDSO_NAME  "LINUX_4.15"
> -# define VDSO_HASH  182943605

VDSO_NAME and VDSO_HASH have defined in if-else-clause,
so those two lines seem redundant?

> +# if __WORDSIZE == 64
> +#  define VDSO_NAME    "LINUX_4.15"
> +#  define VDSO_HASH    182943605
> +
> +/* List of system calls which are supported as vsyscalls only
> +   for RV64.  */
> +#  define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
> +#  define HAVE_CLOCK_GETTIME64_VSYSCALL        "__vdso_clock_gettime"
> +#  define HAVE_GETTIMEOFDAY_VSYSCALL   "__vdso_gettimeofday"
> +# else
> +#  define VDSO_NAME    "LINUX_5.4"
> +#  define VDSO_HASH    61765876
> +
> +/* RV32 does not support the gettime VDSO syscalls.  */
> +# endif
>
> -/* List of system calls which are supported as vsyscalls.  */
> -# define HAVE_CLOCK_GETRES64_VSYSCALL  "__vdso_clock_getres"
> -# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
> -# define HAVE_GETTIMEOFDAY_VSYSCALL    "__vdso_gettimeofday"
> +/* List of system calls which are supported as vsyscalls (for RV32 and
> +   RV64).  */
>  # define HAVE_GETCPU_VSYSCALL          "__vdso_getcpu"
>
>  # define INTERNAL_SYSCALL(name, nr, args...) \
> --
> 2.27.0
>
  

Patch

diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
index 292484b303..6f26c558b1 100644
--- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -135,13 +135,24 @@ 
 
 #else
 
-# define VDSO_NAME  "LINUX_4.15"
-# define VDSO_HASH  182943605
+# if __WORDSIZE == 64
+#  define VDSO_NAME	"LINUX_4.15"
+#  define VDSO_HASH	182943605
+
+/* List of system calls which are supported as vsyscalls only
+   for RV64.  */
+#  define HAVE_CLOCK_GETRES64_VSYSCALL	"__vdso_clock_getres"
+#  define HAVE_CLOCK_GETTIME64_VSYSCALL	"__vdso_clock_gettime"
+#  define HAVE_GETTIMEOFDAY_VSYSCALL	"__vdso_gettimeofday"
+# else
+#  define VDSO_NAME	"LINUX_5.4"
+#  define VDSO_HASH	61765876
+
+/* RV32 does not support the gettime VDSO syscalls.  */
+# endif
 
-/* List of system calls which are supported as vsyscalls.  */
-# define HAVE_CLOCK_GETRES64_VSYSCALL	"__vdso_clock_getres"
-# define HAVE_CLOCK_GETTIME64_VSYSCALL	"__vdso_clock_gettime"
-# define HAVE_GETTIMEOFDAY_VSYSCALL	"__vdso_gettimeofday"
+/* List of system calls which are supported as vsyscalls (for RV32 and
+   RV64).  */
 # define HAVE_GETCPU_VSYSCALL		"__vdso_getcpu"
 
 # define INTERNAL_SYSCALL(name, nr, args...) \