From: Greg Hackmann <ghackmann@google.com>
To: Shuah Khan <shuah@kernel.org>
Cc: Steve Muckle <smuckle@google.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Greg Hackmann <ghackmann@google.com>
Subject: [PATCH] selftests: vdso_test: support ARM64 targets
Date: Tue, 31 Oct 2017 14:28:46 -0700 [thread overview]
Message-ID: <20171031212846.17301-1-ghackmann@google.com> (raw)
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>
---
tools/testing/selftests/vDSO/vdso_test.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/vDSO/vdso_test.c b/tools/testing/selftests/vDSO/vdso_test.c
index 8daeb7d7032c..f0f8cc59c195 100644
--- a/tools/testing/selftests/vDSO/vdso_test.c
+++ b/tools/testing/selftests/vDSO/vdso_test.c
@@ -21,6 +21,17 @@ extern void vdso_init_from_auxv(void *auxv);
int main(int argc, char **argv)
{
+ const char *version;
+ const char *name;
+
+#if defined(__aarch64__)
+ version = "LINUX_2.6.39";
+ name = "__kernel_gettimeofday";
+#else
+ version = "LINUX_2.6";
+ name = "__vdso_gettimeofday";
+#endif
+
unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
if (!sysinfo_ehdr) {
printf("AT_SYSINFO_EHDR is not present!\n");
@@ -31,10 +42,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 +56,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;
--
2.15.0.403.gc27cc4dac6-goog
next reply other threads:[~2017-10-31 21:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 21:28 Greg Hackmann [this message]
2017-11-01 21:24 ` [PATCH] selftests: vdso_test: support ARM64 targets Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171031212846.17301-1-ghackmann@google.com \
--to=ghackmann@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=smuckle@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.