PATCH, testsuite, x86] Make the requires test for CET a bit stronger.

Message ID 93AF3828-84AA-46A2-AAC0-7A4C4618ECB1@sandoe.co.uk
State New
Headers show
Series
  • PATCH, testsuite, x86] Make the requires test for CET a bit stronger.
Related show

Commit Message

Iain Sandoe May 15, 2019, 4:48 p.m.
Hi,

There is at least one assembler that supports ‘setssbsy' but not “endbr*”.
We can catch this by adding "-fcf-protection” to the check_effective_target_cet test.

OK for trunk?
Iain

gcc/testsuite/

	*lib/target-supports.exp (check_effective_target_cet): Add the
	fcf-protection flag to tet CET test.

-- 
2.17.1

Comments

Uros Bizjak May 15, 2019, 6:02 p.m. | #1
On Wed, May 15, 2019 at 6:48 PM Iain Sandoe <iain@sandoe.co.uk> wrote:
>

> Hi,

>

> There is at least one assembler that supports ‘setssbsy' but not “endbr*”.

> We can catch this by adding "-fcf-protection” to the check_effective_target_cet test.


How about adding asm ("endbr") to the source?

Uros.

> OK for trunk?

> Iain

>

> gcc/testsuite/

>

>         *lib/target-supports.exp (check_effective_target_cet): Add the

>         fcf-protection flag to tet CET test.

>

> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp

> index da132369a4..b7c6bb67ce 100644

> --- a/gcc/testsuite/lib/target-supports.exp

> +++ b/gcc/testsuite/lib/target-supports.exp

> @@ -9212,7 +9212,7 @@ proc check_effective_target_cet { } {

>         {

>           asm ("setssbsy");

>         }

> -    } "-O2" ]

> +    } "-O2 -fcf-protection" ]

> }

>

> # Return 1 if target supports floating point "infinite"

> --

> 2.17.1
Iain Sandoe May 15, 2019, 6:29 p.m. | #2
> On 15 May 2019, at 19:02, Uros Bizjak <ubizjak@gmail.com> wrote:

> 

> On Wed, May 15, 2019 at 6:48 PM Iain Sandoe <iain@sandoe.co.uk> wrote:

>> 

>> Hi,

>> 

>> There is at least one assembler that supports ‘setssbsy' but not “endbr*”.

>> We can catch this by adding "-fcf-protection” to the check_effective_target_cet test.

> 

> How about adding asm ("endbr") to the source?


it would have to be ‘endbr32’ or ‘endbr64’  I suppose.. I guess

#if __LP64__
  asm (“endbr64”);
#else
 asm (“endbr32”):
#endif

would work? 

AFAICT that’s effectively what adding -fcf-protection does.

I’m happy with either.
Iain
Uros Bizjak May 15, 2019, 6:43 p.m. | #3
On Wed, May 15, 2019 at 8:29 PM Iain Sandoe <iain@sandoe.co.uk> wrote:
>

>

> > On 15 May 2019, at 19:02, Uros Bizjak <ubizjak@gmail.com> wrote:

> >

> > On Wed, May 15, 2019 at 6:48 PM Iain Sandoe <iain@sandoe.co.uk> wrote:

> >>

> >> Hi,

> >>

> >> There is at least one assembler that supports ‘setssbsy' but not “endbr*”.

> >> We can catch this by adding "-fcf-protection” to the check_effective_target_cet test.

> >

> > How about adding asm ("endbr") to the source?

>

> it would have to be ‘endbr32’ or ‘endbr64’  I suppose.. I guess

>

> #if __LP64__

>   asm (“endbr64”);

> #else

>  asm (“endbr32”):

> #endif

>

> would work?

>

> AFAICT that’s effectively what adding -fcf-protection does.

>

> I’m happy with either.


No need to complicate things too much, your original patch is OK.

Thanks,
Uros.

> Iain

>

>

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index da132369a4..b7c6bb67ce 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9212,7 +9212,7 @@  proc check_effective_target_cet { } {
	{
	  asm ("setssbsy");
	}
-    } "-O2" ]
+    } "-O2 -fcf-protection" ]
}

# Return 1 if target supports floating point "infinite"