Commit 2ab9c93d authored by John Hubbard's avatar John Hubbard Committed by Shuah Khan

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: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 11586553
...@@ -115,6 +115,7 @@ $(eval $(call extra-files,ptrace_syscall_32,raw_syscall_helper_32.S)) ...@@ -115,6 +115,7 @@ $(eval $(call extra-files,ptrace_syscall_32,raw_syscall_helper_32.S))
$(eval $(call extra-files,test_syscall_vdso_32,thunks_32.S)) $(eval $(call extra-files,test_syscall_vdso_32,thunks_32.S))
$(eval $(call extra-files,fsgsbase_restore_64,clang_helpers_64.S)) $(eval $(call extra-files,fsgsbase_restore_64,clang_helpers_64.S))
$(eval $(call extra-files,fsgsbase_restore_32,clang_helpers_32.S)) $(eval $(call extra-files,fsgsbase_restore_32,clang_helpers_32.S))
$(eval $(call extra-files,sysret_rip_64,clang_helpers_64.S))
# check_initial_reg_state is special: it needs a custom entry, and it # check_initial_reg_state is special: it needs a custom entry, and it
# needs to be static so that its interpreter doesn't destroy its initial # needs to be static so that its interpreter doesn't destroy its initial
......
...@@ -9,4 +9,20 @@ dereference_seg_base: ...@@ -9,4 +9,20 @@ dereference_seg_base:
mov %gs:(0), %rax mov %gs:(0), %rax
ret ret
.global test_page
.global test_syscall_insn
.pushsection ".text", "ax"
.balign 4096
test_page: .globl test_page
.fill 4094,1,0xcc
test_syscall_insn:
syscall
.ifne . - test_page - 4096
.error "test page is not one page long"
.endif
.popsection
.section .note.GNU-stack,"",%progbits .section .note.GNU-stack,"",%progbits
...@@ -22,21 +22,13 @@ ...@@ -22,21 +22,13 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <assert.h> #include <assert.h>
/*
asm ( * These items are in clang_helpers_64.S, in order to avoid clang inline asm
".pushsection \".text\", \"ax\"\n\t" * limitations:
".balign 4096\n\t" */
"test_page: .globl test_page\n\t" void test_syscall_ins(void);
".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"
);
extern const char test_page[]; extern const char test_page[];
static void const *current_test_page_addr = test_page; static void const *current_test_page_addr = test_page;
static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *), static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment