diff options
author | Greg Hackmann <ghackmann@google.com> | 2017-11-01 17:34:26 -0400 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2017-11-15 10:01:43 -0500 |
commit | 2650554da3f895a7bc276127dac4ec43b7b860c0 (patch) | |
tree | e43be284d7c1074920a7fca904131cfb0953fe7a | |
parent | 8d17a6fe5d3cd635b48818b8da58a0e3ca4c2553 (diff) |
selftests: vdso_test: support ARM64 targets
ARM64's vDSO exports its gettimeofday() implementation with a different
name (__kernel_gettimeofday) and version (LINUX_2.6.39) from other
architectures. Add a corresponding special-case to vdso_test.
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
-rw-r--r-- | tools/testing/selftests/vDSO/vdso_test.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/testing/selftests/vDSO/vdso_test.c b/tools/testing/selftests/vDSO/vdso_test.c index 8daeb7d7032c..2df26bd0099c 100644 --- a/tools/testing/selftests/vDSO/vdso_test.c +++ b/tools/testing/selftests/vDSO/vdso_test.c | |||
@@ -19,6 +19,19 @@ extern void *vdso_sym(const char *version, const char *name); | |||
19 | extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); | 19 | extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); |
20 | extern void vdso_init_from_auxv(void *auxv); | 20 | extern void vdso_init_from_auxv(void *auxv); |
21 | 21 | ||
22 | /* | ||
23 | * ARM64's vDSO exports its gettimeofday() implementation with a different | ||
24 | * name and version from other architectures, so we need to handle it as | ||
25 | * a special case. | ||
26 | */ | ||
27 | #if defined(__aarch64__) | ||
28 | const char *version = "LINUX_2.6.39"; | ||
29 | const char *name = "__kernel_gettimeofday"; | ||
30 | #else | ||
31 | const char *version = "LINUX_2.6"; | ||
32 | const char *name = "__vdso_gettimeofday"; | ||
33 | #endif | ||
34 | |||
22 | int main(int argc, char **argv) | 35 | int main(int argc, char **argv) |
23 | { | 36 | { |
24 | unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); | 37 | unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); |
@@ -31,10 +44,10 @@ int main(int argc, char **argv) | |||
31 | 44 | ||
32 | /* Find gettimeofday. */ | 45 | /* Find gettimeofday. */ |
33 | typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz); | 46 | typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz); |
34 | gtod_t gtod = (gtod_t)vdso_sym("LINUX_2.6", "__vdso_gettimeofday"); | 47 | gtod_t gtod = (gtod_t)vdso_sym(version, name); |
35 | 48 | ||
36 | if (!gtod) { | 49 | if (!gtod) { |
37 | printf("Could not find __vdso_gettimeofday\n"); | 50 | printf("Could not find %s\n", name); |
38 | return 1; | 51 | return 1; |
39 | } | 52 | } |
40 | 53 | ||
@@ -45,7 +58,7 @@ int main(int argc, char **argv) | |||
45 | printf("The time is %lld.%06lld\n", | 58 | printf("The time is %lld.%06lld\n", |
46 | (long long)tv.tv_sec, (long long)tv.tv_usec); | 59 | (long long)tv.tv_sec, (long long)tv.tv_usec); |
47 | } else { | 60 | } else { |
48 | printf("__vdso_gettimeofday failed\n"); | 61 | printf("%s failed\n", name); |
49 | } | 62 | } |
50 | 63 | ||
51 | return 0; | 64 | return 0; |