Message ID | 20240610140437.966245-3-torbjorn.svensson@foss.st.com |
---|---|
State | New |
Headers | show |
Series | arm: Zero/Sign extends for CMSE security on Armv8-M.baseline [PR115253] | expand |
On 10/06/2024 15:04, Torbjörn SVENSSON wrote: > For Armv8.1-M, the clearing of the registers is handled differently than > for Armv8-M, so update the test case accordingly. > > gcc/testsuite/ChangeLog: > > PR target/115253 > * gcc.target/arm/cmse/extend-return.c: Update test case > condition for Armv8.1-M. > > Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> > Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com> > --- > .../gcc.target/arm/cmse/extend-return.c | 62 +++++++++++++++++-- > 1 file changed, 56 insertions(+), 6 deletions(-) > > diff --git a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c > index 081de0d699f..2288d166bd3 100644 > --- a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c > +++ b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c > @@ -1,5 +1,7 @@ > /* { dg-do compile } */ > /* { dg-options "-mcmse -fshort-enums" } */ > +/* ARMv8-M expectation with target { ! arm_cmse_clear_ok }. */ > +/* ARMv8.1-M expectation with target arm_cmse_clear_ok. */ > /* { dg-final { check-function-bodies "**" "" "" } } */ > > #include <arm_cmse.h> > @@ -20,7 +22,15 @@ typedef enum offset __attribute__ ((cmse_nonsecure_call)) ns_enum_foo_t (void); > typedef bool __attribute__ ((cmse_nonsecure_call)) ns_bool_foo_t (void); > > /* > -**unsignNonsecure0: > +**unsignNonsecure0: { target arm_cmse_clear_ok } > +** ... > +** blxns r[0-3] > +** ... > +** uxtb r0, r0 > +** ... > +*/ > +/* > +**unsignNonsecure0: { target { ! arm_cmse_clear_ok } } > ** ... > ** bl __gnu_cmse_nonsecure_call > ** uxtb r0, r0 > @@ -32,7 +42,15 @@ unsigned char unsignNonsecure0 (ns_unsign_foo_t * ns_foo_p) > } > > /* > -**signNonsecure0: > +**signNonsecure0: { target arm_cmse_clear_ok } > +** ... > +** blxns r[0-3] > +** ... > +** sxtb r0, r0 > +** ... > +*/ > +/* > +**signNonsecure0: { target { ! arm_cmse_clear_ok } } > ** ... > ** bl __gnu_cmse_nonsecure_call > ** sxtb r0, r0 > @@ -44,7 +62,15 @@ signed char signNonsecure0 (ns_sign_foo_t * ns_foo_p) > } > > /* > -**shortUnsignNonsecure0: > +**shortUnsignNonsecure0: { target arm_cmse_clear_ok } > +** ... > +** blxns r[0-3] > +** ... > +** uxth r0, r0 > +** ... > +*/ > +/* > +**shortUnsignNonsecure0: { target { ! arm_cmse_clear_ok } } > ** ... > ** bl __gnu_cmse_nonsecure_call > ** uxth r0, r0 > @@ -56,7 +82,15 @@ unsigned short shortUnsignNonsecure0 (ns_short_unsign_foo_t * ns_foo_p) > } > > /* > -**shortSignNonsecure0: > +**shortSignNonsecure0: { target arm_cmse_clear_ok } > +** ... > +** blxns r[0-3] > +** ... > +** sxth r0, r0 > +** ... > +*/ > +/* > +**shortSignNonsecure0: { target { ! arm_cmse_clear_ok } } > ** ... > ** bl __gnu_cmse_nonsecure_call > ** sxth r0, r0 > @@ -68,7 +102,15 @@ signed short shortSignNonsecure0 (ns_short_sign_foo_t * ns_foo_p) > } > > /* > -**enumNonsecure0: > +**enumNonsecure0: { target arm_cmse_clear_ok } > +** ... > +** blxns r[0-3] > +** ... > +** uxtb r0, r0 > +** ... > +*/ > +/* > +**enumNonsecure0: { target { ! arm_cmse_clear_ok } } > ** ... > ** bl __gnu_cmse_nonsecure_call > ** uxtb r0, r0 > @@ -80,7 +122,15 @@ unsigned char __attribute__((noipa)) enumNonsecure0 (ns_enum_foo_t * ns_foo_p) > } > > /* > -**boolNonsecure0: > +**boolNonsecure0: { target arm_cmse_clear_ok } > +** ... > +** blxns r[0-3] > +** ... > +** uxtb r0, r0 > +** ... > +*/ > +/* > +**boolNonsecure0: { target { ! arm_cmse_clear_ok } } > ** ... > ** bl __gnu_cmse_nonsecure_call > ** uxtb r0, r0 OK when the nits in the first patch are sorted. R.
On 2024-06-11 16:00, Richard Earnshaw (lists) wrote: > On 10/06/2024 15:04, Torbjörn SVENSSON wrote: >> For Armv8.1-M, the clearing of the registers is handled differently than >> for Armv8-M, so update the test case accordingly. >> >> gcc/testsuite/ChangeLog: >> >> PR target/115253 >> * gcc.target/arm/cmse/extend-return.c: Update test case >> condition for Armv8.1-M. >> >> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> >> Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com> >> --- >> .../gcc.target/arm/cmse/extend-return.c | 62 +++++++++++++++++-- >> 1 file changed, 56 insertions(+), 6 deletions(-) >> >> diff --git a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c >> index 081de0d699f..2288d166bd3 100644 >> --- a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c >> +++ b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c >> @@ -1,5 +1,7 @@ >> /* { dg-do compile } */ >> /* { dg-options "-mcmse -fshort-enums" } */ >> +/* ARMv8-M expectation with target { ! arm_cmse_clear_ok }. */ >> +/* ARMv8.1-M expectation with target arm_cmse_clear_ok. */ >> /* { dg-final { check-function-bodies "**" "" "" } } */ >> >> #include <arm_cmse.h> >> @@ -20,7 +22,15 @@ typedef enum offset __attribute__ ((cmse_nonsecure_call)) ns_enum_foo_t (void); >> typedef bool __attribute__ ((cmse_nonsecure_call)) ns_bool_foo_t (void); >> >> /* >> -**unsignNonsecure0: >> +**unsignNonsecure0: { target arm_cmse_clear_ok } >> +** ... >> +** blxns r[0-3] >> +** ... >> +** uxtb r0, r0 >> +** ... >> +*/ >> +/* >> +**unsignNonsecure0: { target { ! arm_cmse_clear_ok } } >> ** ... >> ** bl __gnu_cmse_nonsecure_call >> ** uxtb r0, r0 >> @@ -32,7 +42,15 @@ unsigned char unsignNonsecure0 (ns_unsign_foo_t * ns_foo_p) >> } >> >> /* >> -**signNonsecure0: >> +**signNonsecure0: { target arm_cmse_clear_ok } >> +** ... >> +** blxns r[0-3] >> +** ... >> +** sxtb r0, r0 >> +** ... >> +*/ >> +/* >> +**signNonsecure0: { target { ! arm_cmse_clear_ok } } >> ** ... >> ** bl __gnu_cmse_nonsecure_call >> ** sxtb r0, r0 >> @@ -44,7 +62,15 @@ signed char signNonsecure0 (ns_sign_foo_t * ns_foo_p) >> } >> >> /* >> -**shortUnsignNonsecure0: >> +**shortUnsignNonsecure0: { target arm_cmse_clear_ok } >> +** ... >> +** blxns r[0-3] >> +** ... >> +** uxth r0, r0 >> +** ... >> +*/ >> +/* >> +**shortUnsignNonsecure0: { target { ! arm_cmse_clear_ok } } >> ** ... >> ** bl __gnu_cmse_nonsecure_call >> ** uxth r0, r0 >> @@ -56,7 +82,15 @@ unsigned short shortUnsignNonsecure0 (ns_short_unsign_foo_t * ns_foo_p) >> } >> >> /* >> -**shortSignNonsecure0: >> +**shortSignNonsecure0: { target arm_cmse_clear_ok } >> +** ... >> +** blxns r[0-3] >> +** ... >> +** sxth r0, r0 >> +** ... >> +*/ >> +/* >> +**shortSignNonsecure0: { target { ! arm_cmse_clear_ok } } >> ** ... >> ** bl __gnu_cmse_nonsecure_call >> ** sxth r0, r0 >> @@ -68,7 +102,15 @@ signed short shortSignNonsecure0 (ns_short_sign_foo_t * ns_foo_p) >> } >> >> /* >> -**enumNonsecure0: >> +**enumNonsecure0: { target arm_cmse_clear_ok } >> +** ... >> +** blxns r[0-3] >> +** ... >> +** uxtb r0, r0 >> +** ... >> +*/ >> +/* >> +**enumNonsecure0: { target { ! arm_cmse_clear_ok } } >> ** ... >> ** bl __gnu_cmse_nonsecure_call >> ** uxtb r0, r0 >> @@ -80,7 +122,15 @@ unsigned char __attribute__((noipa)) enumNonsecure0 (ns_enum_foo_t * ns_foo_p) >> } >> >> /* >> -**boolNonsecure0: >> +**boolNonsecure0: { target arm_cmse_clear_ok } >> +** ... >> +** blxns r[0-3] >> +** ... >> +** uxtb r0, r0 >> +** ... >> +*/ >> +/* >> +**boolNonsecure0: { target { ! arm_cmse_clear_ok } } >> ** ... >> ** bl __gnu_cmse_nonsecure_call >> ** uxtb r0, r0 > > OK when the nits in the first patch are sorted. > > R. Pushed as: basepoints/gcc-15-1201-gcf5f9171bae releases/gcc-14.1.0-134-g9100e78ba28 releases/gcc-13.3.0-64-gdfab6851eb5 releases/gcc-12.3.0-1035-g3d9e4eedb6b releases/gcc-11.4.0-650-gbf9c877c4c9 Kind regards, Torbjörn
diff --git a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c index 081de0d699f..2288d166bd3 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c +++ b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c @@ -1,5 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse -fshort-enums" } */ +/* ARMv8-M expectation with target { ! arm_cmse_clear_ok }. */ +/* ARMv8.1-M expectation with target arm_cmse_clear_ok. */ /* { dg-final { check-function-bodies "**" "" "" } } */ #include <arm_cmse.h> @@ -20,7 +22,15 @@ typedef enum offset __attribute__ ((cmse_nonsecure_call)) ns_enum_foo_t (void); typedef bool __attribute__ ((cmse_nonsecure_call)) ns_bool_foo_t (void); /* -**unsignNonsecure0: +**unsignNonsecure0: { target arm_cmse_clear_ok } +** ... +** blxns r[0-3] +** ... +** uxtb r0, r0 +** ... +*/ +/* +**unsignNonsecure0: { target { ! arm_cmse_clear_ok } } ** ... ** bl __gnu_cmse_nonsecure_call ** uxtb r0, r0 @@ -32,7 +42,15 @@ unsigned char unsignNonsecure0 (ns_unsign_foo_t * ns_foo_p) } /* -**signNonsecure0: +**signNonsecure0: { target arm_cmse_clear_ok } +** ... +** blxns r[0-3] +** ... +** sxtb r0, r0 +** ... +*/ +/* +**signNonsecure0: { target { ! arm_cmse_clear_ok } } ** ... ** bl __gnu_cmse_nonsecure_call ** sxtb r0, r0 @@ -44,7 +62,15 @@ signed char signNonsecure0 (ns_sign_foo_t * ns_foo_p) } /* -**shortUnsignNonsecure0: +**shortUnsignNonsecure0: { target arm_cmse_clear_ok } +** ... +** blxns r[0-3] +** ... +** uxth r0, r0 +** ... +*/ +/* +**shortUnsignNonsecure0: { target { ! arm_cmse_clear_ok } } ** ... ** bl __gnu_cmse_nonsecure_call ** uxth r0, r0 @@ -56,7 +82,15 @@ unsigned short shortUnsignNonsecure0 (ns_short_unsign_foo_t * ns_foo_p) } /* -**shortSignNonsecure0: +**shortSignNonsecure0: { target arm_cmse_clear_ok } +** ... +** blxns r[0-3] +** ... +** sxth r0, r0 +** ... +*/ +/* +**shortSignNonsecure0: { target { ! arm_cmse_clear_ok } } ** ... ** bl __gnu_cmse_nonsecure_call ** sxth r0, r0 @@ -68,7 +102,15 @@ signed short shortSignNonsecure0 (ns_short_sign_foo_t * ns_foo_p) } /* -**enumNonsecure0: +**enumNonsecure0: { target arm_cmse_clear_ok } +** ... +** blxns r[0-3] +** ... +** uxtb r0, r0 +** ... +*/ +/* +**enumNonsecure0: { target { ! arm_cmse_clear_ok } } ** ... ** bl __gnu_cmse_nonsecure_call ** uxtb r0, r0 @@ -80,7 +122,15 @@ unsigned char __attribute__((noipa)) enumNonsecure0 (ns_enum_foo_t * ns_foo_p) } /* -**boolNonsecure0: +**boolNonsecure0: { target arm_cmse_clear_ok } +** ... +** blxns r[0-3] +** ... +** uxtb r0, r0 +** ... +*/ +/* +**boolNonsecure0: { target { ! arm_cmse_clear_ok } } ** ... ** bl __gnu_cmse_nonsecure_call ** uxtb r0, r0
For Armv8.1-M, the clearing of the registers is handled differently than for Armv8-M, so update the test case accordingly. gcc/testsuite/ChangeLog: PR target/115253 * gcc.target/arm/cmse/extend-return.c: Update test case condition for Armv8.1-M. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com> --- .../gcc.target/arm/cmse/extend-return.c | 62 +++++++++++++++++-- 1 file changed, 56 insertions(+), 6 deletions(-)