summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/x86/sysret_rip.c
diff options
context:
space:
mode:
authorJohn Hubbard <jhubbard@nvidia.com>2024-07-04 10:24:28 +0300
committerShuah Khan <skhan@linuxfoundation.org>2024-07-11 20:23:55 +0300
commit2ab9c93d6104e36110754d0778103f7f8719d969 (patch)
tree702ddcb94810725fcf3e2ae48391b037995b2f3e /tools/testing/selftests/x86/sysret_rip.c
parent1158655317b6b6e71980533939dce9ab91d9716b (diff)
downloadlinux-2ab9c93d6104e36110754d0778103f7f8719d969.tar.xz
selftests/x86: build sysret_rip.c with clang
When building with clang, via: make LLVM=1 -C tools/testing/selftests ...the build fails because clang's inline asm doesn't support all of the features that are used in the asm() snippet in sysret_rip.c. Fix this by moving the asm code into the clang_helpers_64.S file, where it can be built with the assembler's full set of features. Acked-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Signed-off-by: John Hubbard <jhubbard@nvidia.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/x86/sysret_rip.c')
-rw-r--r--tools/testing/selftests/x86/sysret_rip.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/tools/testing/selftests/x86/sysret_rip.c b/tools/testing/selftests/x86/sysret_rip.c
index 84d74be1d902..b30de9aaa6d4 100644
--- a/tools/testing/selftests/x86/sysret_rip.c
+++ b/tools/testing/selftests/x86/sysret_rip.c
@@ -22,21 +22,13 @@
#include <sys/mman.h>
#include <assert.h>
-
-asm (
- ".pushsection \".text\", \"ax\"\n\t"
- ".balign 4096\n\t"
- "test_page: .globl test_page\n\t"
- ".fill 4094,1,0xcc\n\t"
- "test_syscall_insn:\n\t"
- "syscall\n\t"
- ".ifne . - test_page - 4096\n\t"
- ".error \"test page is not one page long\"\n\t"
- ".endif\n\t"
- ".popsection"
- );
-
+/*
+ * These items are in clang_helpers_64.S, in order to avoid clang inline asm
+ * limitations:
+ */
+void test_syscall_ins(void);
extern const char test_page[];
+
static void const *current_test_page_addr = test_page;
static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *),