Skip to contentSkip to conversation

arm64: vdso32: Define BUILD_VDSO32_64 to correct prototypes

PATCH New Nathan Chancellor 1 participant 1 message Nov 28, 2023 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: vdso32: Define BUILD_VDSO32_64 to correct prototypes

After commit 42874e4eb35b ("arch: vdso: consolidate gettime prototypes"), there are a couple of errors when building the 32-bit compat vDSO for arm64:

arch/arm64/kernel/vdso32/vgettimeofday.c:10:5: error: conflicting types for '__vdso_clock_gettime'; have 'int(clockid_t, struct old_timespec32 *)' {aka 'int(int, struct old_timespec32 *)'}
10 | int __vdso_clock_gettime(clockid_t clock,
| ^~~~~~~~~~~~~~~~~~~~
In file included from arch/arm64/kernel/vdso32/vgettimeofday.c:8:
include/vdso/gettime.h:16:5: note: previous declaration of '__vdso_clock_gettime' with type 'int(clockid_t, struct __kernel_timespec *)' {aka 'int(int, struct __kernel_timespec *)'}

     16 | int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts);
        |     ^~~~~~~~~~~~~~~~~~~~
  arch/arm64/kernel/vdso32/vgettimeofday.c:28:5: error: conflicting types for '__vdso_clock_getres'; have 'int(clockid_t,  struct old_timespec32 *)' {aka 'int(int,  struct old_timespec32 *)'}
     28 | int __vdso_clock_getres(clockid_t clock_id,
        |     ^~~~~~~~~~~~~~~~~~~
  include/vdso/gettime.h:15:5: note: previous declaration of '__vdso_clock_getres' with type 'int(clockid_t,  struct __kernel_timespec *)' {aka 'int(int,  struct __kernel_timespec *)'}
     15 | int __vdso_clock_getres(clockid_t clock, struct __kernel_timespec *res);
        |     ^~~~~~~~~~~~~~~~~~~

The type of the second parameter in __vdso_clock_getres() and __vdso_clock_gettime() changes based on whether compiling for 32-bit vs. 64-bit, which is controlled by CONFIG_64BIT or the preprocessor macro BUILD_VDSO32_64, which denotes a 32-bit vDSO is being built for a 64-bit architecture. Since this situation is the latter case, define BUILD_VDSO32_64 before the inclusion of include/vdso/gettime.h to clear up the warning

---
 arch/arm64/kernel/vdso32/vgettimeofday.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kernel/vdso32/vgettimeofday.c +1 -0
index e23c7f4ef26b..29b4d8f61e39 100644
@@ -5,6 +5,7 @@
  * Copyright (C) 2018 ARM Limited
  *
  */
+#define BUILD_VDSO32_64
 #include <vdso/gettime.h>
 
 int __vdso_clock_gettime(clockid_t clock,

---
base-commit: ca8e45c8048a2c9503c74751d25414601f730580
change-id: 20231128-arm64-vdso32-missing-prototypes-error-e0d30a1ce52f

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>