summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/vDSO
diff options
context:
space:
mode:
authorGreg Hackmann <ghackmann@google.com>2017-11-01 14:34:26 -0700
committerShuah Khan <shuahkh@osg.samsung.com>2017-11-15 08:01:43 -0700
commit2650554da3f895a7bc276127dac4ec43b7b860c0 (patch)
treee43be284d7c1074920a7fca904131cfb0953fe7a /tools/testing/selftests/vDSO
parent8d17a6fe5d3cd635b48818b8da58a0e3ca4c2553 (diff)
downloadblackbird-op-linux-2650554da3f895a7bc276127dac4ec43b7b860c0.tar.gz
blackbird-op-linux-2650554da3f895a7bc276127dac4ec43b7b860c0.zip
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>
Diffstat (limited to 'tools/testing/selftests/vDSO')
-rw-r--r--tools/testing/selftests/vDSO/vdso_test.c19
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);
extern void vdso_init_from_sysinfo_ehdr(uintptr_t base);
extern void vdso_init_from_auxv(void *auxv);
+/*
+ * ARM64's vDSO exports its gettimeofday() implementation with a different
+ * name and version from other architectures, so we need to handle it as
+ * a special case.
+ */
+#if defined(__aarch64__)
+const char *version = "LINUX_2.6.39";
+const char *name = "__kernel_gettimeofday";
+#else
+const char *version = "LINUX_2.6";
+const char *name = "__vdso_gettimeofday";
+#endif
+
int main(int argc, char **argv)
{
unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
@@ -31,10 +44,10 @@ int main(int argc, char **argv)
/* Find gettimeofday. */
typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz);
- gtod_t gtod = (gtod_t)vdso_sym("LINUX_2.6", "__vdso_gettimeofday");
+ gtod_t gtod = (gtod_t)vdso_sym(version, name);
if (!gtod) {
- printf("Could not find __vdso_gettimeofday\n");
+ printf("Could not find %s\n", name);
return 1;
}
@@ -45,7 +58,7 @@ int main(int argc, char **argv)
printf("The time is %lld.%06lld\n",
(long long)tv.tv_sec, (long long)tv.tv_usec);
} else {
- printf("__vdso_gettimeofday failed\n");
+ printf("%s failed\n", name);
}
return 0;
OpenPOWER on IntegriCloud