[PATCH] tools: fix testing/selftests/sigaltstack for s390x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On s390x the compilation of the file sas.c in directory
tools/testing/selftests/sigaltstack fails with this error message:

[root@s8360046 sigaltstack]# make
gcc -Wall    sas.c  -o /root/linux/tools/testing/selftests/sigaltstack/sas
sas.c: In function ‘my_usr1’:
sas.c:40:25: error: invalid register name for ‘sp’
  register unsigned long sp asm("sp");
                         ^~
../lib.mk:62: recipe for target '/root/linux/tools/testing/selftests/sigaltstack/sas' failed
make: *** [/root/linux/tools/testing/selftests/sigaltstack/sas] Error 1
[root@s8360046 sigaltstack]#

On s390x the stack pointer is register r15, the register name "sp"
is unknown.
Make this line platform dependend and use register r15.

Which this patch the compilation and test succeeds:

[root@s8360046 sigaltstack]# make
gcc -Wall    sas.c  -o /root/linux/tools/testing/selftests/sigaltstack/sas
[root@s8360046 sigaltstack]# ./sas
[OK]	Initial sigaltstack state was SS_DISABLE
[RUN]	signal USR1
[OK]	sigaltstack is disabled in sighandler
[RUN]	switched to user ctx
[RUN]	signal USR2
[OK]	Stack preserved
[OK]	sigaltstack is still SS_AUTODISARM after signal
[OK]	Test passed
[root@s8360046 sigaltstack]#

Signed-off-by: Thomas Richter <tmricht@xxxxxxxxxxxxxxxxxx>
---
 tools/testing/selftests/sigaltstack/sas.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/sigaltstack/sas.c b/tools/testing/selftests/sigaltstack/sas.c
index ccd0734..4bbd19d 100644
--- a/tools/testing/selftests/sigaltstack/sas.c
+++ b/tools/testing/selftests/sigaltstack/sas.c
@@ -37,7 +37,11 @@ void my_usr1(int sig, siginfo_t *si, void *u)
 	stack_t stk;
 	struct stk_data *p;
 
+#if __s390x__
+	register unsigned long sp asm("%15");
+#else
 	register unsigned long sp asm("sp");
+#endif
 
 	if (sp < (unsigned long)sstack ||
 			sp >= (unsigned long)sstack + SIGSTKSZ) {
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux