* [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0
@ 2015-08-17 12:13 Stanislav Kholmanskikh
2015-08-17 12:13 ` [LTP] [PATCH 2/2] containers: allow linking with additional libs Stanislav Kholmanskikh
2015-08-17 12:49 ` [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0 Jan Stancek
0 siblings, 2 replies; 5+ messages in thread
From: Stanislav Kholmanskikh @ 2015-08-17 12:13 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
The *sigreturn_stub functions are copied from glibc, and they
work only if optimization > 0, since they expect that the compiler
does not add an epilogue.
For example, with -O > 0:
0000000000102140 <__rt_sigreturn_stub>:
102140: 82 10 20 65 mov 0x65, %g1 ! 65 <_init-0x101f23>
102144: 91 d0 20 6d ta 0x6d
102148: 81 c3 e0 08 retl
10214c: 01 00 00 00 nop
but without -O:
000000000010212c <__rt_sigreturn_stub>:
10212c: 9d e3 bf 50 save %sp, -176, %sp <--- this
102130: 82 10 20 65 mov 0x65, %g1
102134: 91 d0 20 6d ta 0x6d
102138: 81 cf e0 08 rett %i7 + 8
10213c: 01 00 00 00 nop
Therefore, if we build LTP with OPT_CFLAGS="", ltp_rt_sigaction() will
malfunction.
To avoid this, let's declare a new symbol pointing to the instruction we
need ('mov ...').
The trick was proposed by Jose E. Marchesi <jose.marchesi@oracle.com>.
Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
include/lapi/rt_sigaction.h | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
index 46f6a50..f99c372 100644
--- a/include/lapi/rt_sigaction.h
+++ b/include/lapi/rt_sigaction.h
@@ -105,12 +105,14 @@ static inline int sig_initial(int sig)
# if defined __arch64__ || defined __sparcv9
/*
- * From glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
+ * Based on glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
*/
+extern char *__rt_sig_stub;
+
static void __rt_sigreturn_stub(void)
{
- __asm__ ("mov %0, %%g1\n\t"
+ __asm__ ("__rt_sig_stub: mov %0, %%g1\n\t"
"ta 0x6d\n\t"
: /* no outputs */
: "i" (__NR_rt_sigreturn));
@@ -119,12 +121,14 @@ static void __rt_sigreturn_stub(void)
# else /* sparc32 */
/*
- * From glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
+ * Based on glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
*/
+extern char *__rt_sig_stub, *__sig_stub;
+
static void __rt_sigreturn_stub(void)
{
- __asm__ ("mov %0, %%g1\n\t"
+ __asm__ ("__rt_sig_stub: mov %0, %%g1\n\t"
"ta 0x10\n\t"
: /* no outputs */
: "i" (__NR_rt_sigreturn));
@@ -132,7 +136,7 @@ static void __rt_sigreturn_stub(void)
static void __sigreturn_stub(void)
{
- __asm__ ("mov %0, %%g1\n\t"
+ __asm__ ("__sig_stub: mov %0, %%g1\n\t"
"ta 0x10\n\t"
: /* no outputs */
: "i" (__NR_sigreturn));
@@ -181,12 +185,12 @@ static int ltp_rt_sigaction(int signum, const struct sigaction *act,
#ifdef __sparc__
unsigned long stub = 0;
# if defined __arch64__ || defined __sparcv9
- stub = ((unsigned long) &__rt_sigreturn_stub) - 8;
+ stub = ((unsigned long) &__rt_sig_stub) - 8;
# else /* sparc32 */
if ((kact.sa_flags & SA_SIGINFO) != 0)
- stub = ((unsigned long) &__rt_sigreturn_stub) - 8;
+ stub = ((unsigned long) &__rt_sig_stub) - 8;
else
- stub = ((unsigned long) &__sigreturn_stub) - 8;
+ stub = ((unsigned long) &__sig_stub) - 8;
# endif
#endif
--
1.7.1
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH 2/2] containers: allow linking with additional libs
2015-08-17 12:13 [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0 Stanislav Kholmanskikh
@ 2015-08-17 12:13 ` Stanislav Kholmanskikh
2015-08-17 12:49 ` [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0 Jan Stancek
1 sibling, 0 replies; 5+ messages in thread
From: Stanislav Kholmanskikh @ 2015-08-17 12:13 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Makefiles in kernel/containers explicitly enumerate all
required libraries in LDLIBS. This avoids linking the
test cases with additional libraries, whereas all other LTP
test cases can be linked this way.
Fixed this by using $(LDLIBS) instead of '-lltp'.
Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
testcases/kernel/containers/mountns/Makefile | 2 +-
testcases/kernel/containers/mqns/Makefile | 2 +-
testcases/kernel/containers/pidns/Makefile | 2 +-
testcases/kernel/containers/sysvipc/Makefile | 2 +-
testcases/kernel/containers/userns/Makefile | 2 +-
testcases/kernel/containers/utsname/Makefile | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/containers/mountns/Makefile b/testcases/kernel/containers/mountns/Makefile
index f9b6b99..bd42bf4 100644
--- a/testcases/kernel/containers/mountns/Makefile
+++ b/testcases/kernel/containers/mountns/Makefile
@@ -18,6 +18,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
include $(abs_srcdir)/../Makefile.inc
-LDLIBS := -lclone -lltp
+LDLIBS := -lclone $(LDLIBS)
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/containers/mqns/Makefile b/testcases/kernel/containers/mqns/Makefile
index ec30e7d..64c3763 100644
--- a/testcases/kernel/containers/mqns/Makefile
+++ b/testcases/kernel/containers/mqns/Makefile
@@ -24,6 +24,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
include $(abs_srcdir)/../Makefile.inc
-LDLIBS := -lpthread -lrt -lclone -lltp
+LDLIBS := -lpthread -lrt -lclone $(LDLIBS)
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/containers/pidns/Makefile b/testcases/kernel/containers/pidns/Makefile
index 6dfe694..886e397 100644
--- a/testcases/kernel/containers/pidns/Makefile
+++ b/testcases/kernel/containers/pidns/Makefile
@@ -23,6 +23,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
include $(abs_srcdir)/../Makefile.inc
-LDLIBS := -lpthread -lrt -lclone -lltp
+LDLIBS := -lpthread -lrt -lclone $(LDLIBS)
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/containers/sysvipc/Makefile b/testcases/kernel/containers/sysvipc/Makefile
index c237e92..00b537f 100644
--- a/testcases/kernel/containers/sysvipc/Makefile
+++ b/testcases/kernel/containers/sysvipc/Makefile
@@ -23,6 +23,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
include $(abs_srcdir)/../Makefile.inc
-LDLIBS := -lclone -lltp
+LDLIBS := -lclone $(LDLIBS)
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/containers/userns/Makefile b/testcases/kernel/containers/userns/Makefile
index 8370bff..8068109 100644
--- a/testcases/kernel/containers/userns/Makefile
+++ b/testcases/kernel/containers/userns/Makefile
@@ -21,6 +21,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
include $(abs_srcdir)/../Makefile.inc
-LDLIBS := -lclone -lltp $(CAP_LIBS)
+LDLIBS := -lclone $(LDLIBS) $(CAP_LIBS)
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/containers/utsname/Makefile b/testcases/kernel/containers/utsname/Makefile
index 93c558e..5efcbf6 100644
--- a/testcases/kernel/containers/utsname/Makefile
+++ b/testcases/kernel/containers/utsname/Makefile
@@ -23,6 +23,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
include $(abs_srcdir)/../Makefile.inc
-LDLIBS := -lclone -lpthread -lrt -lltp
+LDLIBS := -lclone -lpthread -lrt $(LDLIBS)
include $(top_srcdir)/include/mk/generic_leaf_target.mk
--
1.7.1
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0
2015-08-17 12:13 [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0 Stanislav Kholmanskikh
2015-08-17 12:13 ` [LTP] [PATCH 2/2] containers: allow linking with additional libs Stanislav Kholmanskikh
@ 2015-08-17 12:49 ` Jan Stancek
2015-08-17 13:17 ` Stanislav Kholmanskikh
1 sibling, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2015-08-17 12:49 UTC (permalink / raw)
To: Stanislav Kholmanskikh; +Cc: vasily isaenko, ltp-list
----- Original Message -----
> From: "Stanislav Kholmanskikh" <stanislav.kholmanskikh@oracle.com>
> To: ltp-list@lists.sourceforge.net
> Cc: "vasily isaenko" <vasily.isaenko@oracle.com>
> Sent: Monday, 17 August, 2015 2:13:17 PM
> Subject: [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0
>
> The *sigreturn_stub functions are copied from glibc, and they
> work only if optimization > 0, since they expect that the compiler
> does not add an epilogue.
Isn't that prologue?
Other than that it looks good to me, ACK.
Regards,
Jan
>
> For example, with -O > 0:
>
> 0000000000102140 <__rt_sigreturn_stub>:
> 102140: 82 10 20 65 mov 0x65, %g1 ! 65 <_init-0x101f23>
> 102144: 91 d0 20 6d ta 0x6d
> 102148: 81 c3 e0 08 retl
> 10214c: 01 00 00 00 nop
>
> but without -O:
>
> 000000000010212c <__rt_sigreturn_stub>:
> 10212c: 9d e3 bf 50 save %sp, -176, %sp <--- this
> 102130: 82 10 20 65 mov 0x65, %g1
> 102134: 91 d0 20 6d ta 0x6d
> 102138: 81 cf e0 08 rett %i7 + 8
> 10213c: 01 00 00 00 nop
>
> Therefore, if we build LTP with OPT_CFLAGS="", ltp_rt_sigaction() will
> malfunction.
>
> To avoid this, let's declare a new symbol pointing to the instruction we
> need ('mov ...').
>
> The trick was proposed by Jose E. Marchesi <jose.marchesi@oracle.com>.
>
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
> include/lapi/rt_sigaction.h | 20 ++++++++++++--------
> 1 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
> index 46f6a50..f99c372 100644
> --- a/include/lapi/rt_sigaction.h
> +++ b/include/lapi/rt_sigaction.h
> @@ -105,12 +105,14 @@ static inline int sig_initial(int sig)
> # if defined __arch64__ || defined __sparcv9
>
> /*
> - * From glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
> + * Based on glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
> */
>
> +extern char *__rt_sig_stub;
> +
> static void __rt_sigreturn_stub(void)
> {
> - __asm__ ("mov %0, %%g1\n\t"
> + __asm__ ("__rt_sig_stub: mov %0, %%g1\n\t"
> "ta 0x6d\n\t"
> : /* no outputs */
> : "i" (__NR_rt_sigreturn));
> @@ -119,12 +121,14 @@ static void __rt_sigreturn_stub(void)
> # else /* sparc32 */
>
> /*
> - * From glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
> + * Based on glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
> */
>
> +extern char *__rt_sig_stub, *__sig_stub;
> +
> static void __rt_sigreturn_stub(void)
> {
> - __asm__ ("mov %0, %%g1\n\t"
> + __asm__ ("__rt_sig_stub: mov %0, %%g1\n\t"
> "ta 0x10\n\t"
> : /* no outputs */
> : "i" (__NR_rt_sigreturn));
> @@ -132,7 +136,7 @@ static void __rt_sigreturn_stub(void)
>
> static void __sigreturn_stub(void)
> {
> - __asm__ ("mov %0, %%g1\n\t"
> + __asm__ ("__sig_stub: mov %0, %%g1\n\t"
> "ta 0x10\n\t"
> : /* no outputs */
> : "i" (__NR_sigreturn));
> @@ -181,12 +185,12 @@ static int ltp_rt_sigaction(int signum, const struct
> sigaction *act,
> #ifdef __sparc__
> unsigned long stub = 0;
> # if defined __arch64__ || defined __sparcv9
> - stub = ((unsigned long) &__rt_sigreturn_stub) - 8;
> + stub = ((unsigned long) &__rt_sig_stub) - 8;
> # else /* sparc32 */
> if ((kact.sa_flags & SA_SIGINFO) != 0)
> - stub = ((unsigned long) &__rt_sigreturn_stub) - 8;
> + stub = ((unsigned long) &__rt_sig_stub) - 8;
> else
> - stub = ((unsigned long) &__sigreturn_stub) - 8;
> + stub = ((unsigned long) &__sig_stub) - 8;
> # endif
> #endif
>
> --
> 1.7.1
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0
2015-08-17 12:49 ` [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0 Jan Stancek
@ 2015-08-17 13:17 ` Stanislav Kholmanskikh
2015-08-19 14:22 ` Stanislav Kholmanskikh
0 siblings, 1 reply; 5+ messages in thread
From: Stanislav Kholmanskikh @ 2015-08-17 13:17 UTC (permalink / raw)
To: Jan Stancek; +Cc: vasily isaenko, ltp-list
On 08/17/2015 03:49 PM, Jan Stancek wrote:
>
>
>
>
> ----- Original Message -----
>> From: "Stanislav Kholmanskikh" <stanislav.kholmanskikh@oracle.com>
>> To: ltp-list@lists.sourceforge.net
>> Cc: "vasily isaenko" <vasily.isaenko@oracle.com>
>> Sent: Monday, 17 August, 2015 2:13:17 PM
>> Subject: [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0
>>
>> The *sigreturn_stub functions are copied from glibc, and they
>> work only if optimization > 0, since they expect that the compiler
>> does not add an epilogue.
>
> Isn't that prologue?
> Other than that it looks good to me, ACK.
Yes, sure. You are right. That was my typo :-[
Thanks.
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0
2015-08-17 13:17 ` Stanislav Kholmanskikh
@ 2015-08-19 14:22 ` Stanislav Kholmanskikh
0 siblings, 0 replies; 5+ messages in thread
From: Stanislav Kholmanskikh @ 2015-08-19 14:22 UTC (permalink / raw)
To: Jan Stancek; +Cc: vasily isaenko, ltp-list
On 08/17/2015 04:17 PM, Stanislav Kholmanskikh wrote:
>
>
> On 08/17/2015 03:49 PM, Jan Stancek wrote:
>>
>>
>>
>>
>> ----- Original Message -----
>>> From: "Stanislav Kholmanskikh" <stanislav.kholmanskikh@oracle.com>
>>> To: ltp-list@lists.sourceforge.net
>>> Cc: "vasily isaenko" <vasily.isaenko@oracle.com>
>>> Sent: Monday, 17 August, 2015 2:13:17 PM
>>> Subject: [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0
>>>
>>> The *sigreturn_stub functions are copied from glibc, and they
>>> work only if optimization > 0, since they expect that the compiler
>>> does not add an epilogue.
>>
>> Isn't that prologue?
>> Other than that it looks good to me, ACK.
>
> Yes, sure. You are right. That was my typo :-[
Pushed both the patches.
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-19 14:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-17 12:13 [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0 Stanislav Kholmanskikh
2015-08-17 12:13 ` [LTP] [PATCH 2/2] containers: allow linking with additional libs Stanislav Kholmanskikh
2015-08-17 12:49 ` [LTP] [PATCH 1/2] ltp_rt_sigaction: SPARC fixes for -O0 Jan Stancek
2015-08-17 13:17 ` Stanislav Kholmanskikh
2015-08-19 14:22 ` Stanislav Kholmanskikh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox