[LTP] [PATCH v2] syscalls/signal06: loop being clobbered by syscall on clang

Edward Liaw edliaw@google.com
Fri Aug 19 23:31:48 CEST 2022


Indicate to the compiler that the syscall will modify registers rcx
and r11 to prevent loop from getting clobbered.

Signed-off-by: Edward Liaw <edliaw@google.com>

---
When I combined the asm instruction into one line, it threw an error
that the "Asm-specifier for input or output variable conflicts with asm
clobber list" for rax.  I omitted it for now, but I'm not sure if that
is correct.

Also, is it ok to change the subject line like I did?
---
 testcases/kernel/syscalls/signal/signal06.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/signal/signal06.c b/testcases/kernel/syscalls/signal/signal06.c
index 64f886ee3..fba380610 100644
--- a/testcases/kernel/syscalls/signal/signal06.c
+++ b/testcases/kernel/syscalls/signal/signal06.c
@@ -72,8 +72,7 @@ void test(void)
 	while (D == VALUE && loop < LOOPS) {
 		/* sys_tkill(pid, SIGHUP); asm to avoid save/reload
 		 * fp regs around c call */
-		asm ("" : : "a"(__NR_tkill), "D"(pid), "S"(SIGHUP));
-		asm ("syscall" : : : "ax");
+		asm volatile ("syscall" : : "a"(__NR_tkill), "D"(pid), "S"(SIGHUP) : "rcx", "r11");
 
 		loop++;
 	}
-- 
2.37.2.609.g9ff673ca1a-goog



More information about the ltp mailing list