Signed-off-by: Jiri Jaburek <jjabu...@redhat.com>
---
 testcases/kernel/syscalls/profil/profil01.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/testcases/kernel/syscalls/profil/profil01.c 
b/testcases/kernel/syscalls/profil/profil01.c
index ec752cb..37106fc 100644
--- a/testcases/kernel/syscalls/profil/profil01.c
+++ b/testcases/kernel/syscalls/profil/profil01.c
@@ -49,7 +49,16 @@ static void alrm_handler(int sig)
 
 static void __attribute__ ((noinline)) *get_pc(void)
 {
+#if defined(__s390__) && __WORDSIZE == 32
+       /* taken from glibc,
+        *   sysdeps/unix/sysv/linux/s390/s390-32/profil-counter.h
+        * 31-bit s390 pointers don't use the 32th bit, however integers do,
+        * so wrap the value around at 31 bits */
+       return (void *)
+               ((unsigned long) __builtin_return_address(0) & 0x7fffffffUL);
+#else
        return __builtin_return_address(0);
+#endif
 }
 
 static void test_profil(void)
-- 
2.1.0


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to