0001-perf-Alias-SYS_futex-with-SYS_futex_time64-on-32-bit.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From 4965d191806c9a28bffbb157228bf42270b0008e Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Mon, 16 Nov 2020 11:03:31 -0800
  4. Subject: [PATCH] perf: Alias SYS_futex with SYS_futex_time64 on 32-bit arches
  5. with 64bit time_t
  6. glibc does not define SYS_futex for 32bit architectures using 64bit
  7. time_t e.g. riscv32, therefore perf fails to compile as it does not find
  8. SYS_futex in C library headers, define it to SYS_futex_time64 when it
  9. exists
  10. Upstream-Status: Pending
  11. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12. ---
  13. tools/perf/bench/futex.h | 13 +++++++++++++
  14. 1 file changed, 13 insertions(+)
  15. diff --git a/tools/perf/bench/futex.h b/tools/perf/bench/futex.h
  16. index 31b53cc7d5bc..33f3f3230ae1 100644
  17. --- a/tools/perf/bench/futex.h
  18. +++ b/tools/perf/bench/futex.h
  19. @@ -13,6 +13,19 @@
  20. #include <sys/types.h>
  21. #include <linux/futex.h>
  22. +/**
  23. + * SYS_futex is expected from system C library,
  24. + * in glibc (/usr/include/bits/syscall.h defines it in terms of of NR_futex)
  25. + * some newer 32bit architectures e.g. RISCV32 is using 64bit time_t from
  26. + * get go unlike other 32bit architectures in glibc, therefore it wont have
  27. + * NR_futex defined but just NR_futex_time64 this aliases it to NR_futex
  28. + * so that SYS_futex is then defined for rv32
  29. +*/
  30. +
  31. +#if !defined(SYS_futex) && defined(SYS_futex_time64)
  32. +#define SYS_futex SYS_futex_time64
  33. +#endif
  34. +
  35. /**
  36. * futex() - SYS_futex syscall wrapper
  37. * @uaddr: address of first futex
  38. --
  39. 2.29.2