0001-Define-__NR_futex-to-be-__NR_futex_time64-on-riscv32.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From 39c985e3f03c9c7d361c2fa3dcbe8104a868d959 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Tue, 28 Apr 2020 20:30:56 -0700
  4. Subject: [PATCH] Define __NR_futex to be __NR_futex_time64 on riscv32
  5. RISCV glibc has decided to use 64bit time_t from get go unlike
  6. other 32bit architecture therefore aliasing __NR_futex to
  7. __NR_futex_time64 helps avoid the below errors on rv32
  8. tst_checkpoint.c:99:17: error: use of undeclared identifier 'SYS_futex'
  9. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  10. ---
  11. lib/tst_checkpoint.c | 4 ++++
  12. testcases/kernel/syscalls/clone/clone08.c | 4 ++++
  13. testcases/kernel/syscalls/futex/futextest.h | 4 ++++
  14. 3 files changed, 12 insertions(+)
  15. diff --git a/lib/tst_checkpoint.c b/lib/tst_checkpoint.c
  16. index 5e5b11496c..0388e9db2f 100644
  17. --- a/lib/tst_checkpoint.c
  18. +++ b/lib/tst_checkpoint.c
  19. @@ -21,6 +21,10 @@
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. +#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32
  23. +# define __NR_futex __NR_futex_time64
  24. +#endif
  25. +
  26. #include <stdint.h>
  27. #include <limits.h>
  28. #include <errno.h>
  29. diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c
  30. index aace308068..85a2bd9246 100644
  31. --- a/testcases/kernel/syscalls/clone/clone08.c
  32. +++ b/testcases/kernel/syscalls/clone/clone08.c
  33. @@ -5,6 +5,10 @@
  34. * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
  35. */
  36. +#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32
  37. +# define __NR_futex __NR_futex_time64
  38. +#endif
  39. +
  40. #define _GNU_SOURCE
  41. #include <stdlib.h>
  42. #include <stdio.h>
  43. diff --git a/testcases/kernel/syscalls/futex/futextest.h b/testcases/kernel/syscalls/futex/futextest.h
  44. index 5754d36dae..59d877e30f 100644
  45. --- a/testcases/kernel/syscalls/futex/futextest.h
  46. +++ b/testcases/kernel/syscalls/futex/futextest.h
  47. @@ -34,6 +34,10 @@
  48. #ifndef _FUTEXTEST_H
  49. #define _FUTEXTEST_H
  50. +#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32
  51. +# define __NR_futex __NR_futex_time64
  52. +#endif
  53. +
  54. #include <unistd.h>
  55. #include <sys/syscall.h>
  56. #include <sys/types.h>
  57. --
  58. 2.26.2