rs6000: Fix check_effective_target_rop_ok [PR103556, PR103586]

Message ID 3abc21d8-9c52-f803-96af-2aa3c7ab6447@linux.ibm.com
State New
Headers
Series rs6000: Fix check_effective_target_rop_ok [PR103556, PR103586] |

Commit Message

Peter Bergner Dec. 7, 2021, 6:20 p.m. UTC
  The new rop_ok effective target test doesn't correctly compute its expression
result.  Solution is to wrap the test within a expr {} statement.

This has been verified to work on both powerpc64le-linux and powerpc64-linux.
The original test case accidentally worked on LE, but failed on BE.  Now we
correctly run the rop tests on LE and mark them as UNSUPPORTED on BE.

Ok for trunk?

Peter

gcc/testsuite/
	PR target/103556
	PR target/103586
	* lib/target-supports.exp (check_effective_target_rop_ok): Use expr {}.
  

Comments

Peter Bergner Dec. 7, 2021, 9:22 p.m. UTC | #1
On 12/7/21 12:20 PM, Peter Bergner wrote:
>  proc check_effective_target_rop_ok { } {
> -    return [check_effective_target_power10_ok]
> -	    && [check_effective_target_powerpc_elfv2]
> +    return [expr { [check_effective_target_power10_ok]
> +		   && [check_effective_target_powerpc_elfv2] }]

Speaking with Segher offline, he mentioned that a newline ends a
statement, so the easiest "fix" is to just place the original code
on one line.  That was approved by Segher and committed.  Thanks.

Peter
  

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 7956c387c55..50eef9d453b 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -6631,8 +6631,8 @@  proc check_effective_target_powerpc_elfv2 { } {
 # Return 1 if this is a PowerPC target supporting -mrop-protect
 
 proc check_effective_target_rop_ok { } {
-    return [check_effective_target_power10_ok]
-	    && [check_effective_target_powerpc_elfv2]
+    return [expr { [check_effective_target_power10_ok]
+		   && [check_effective_target_powerpc_elfv2] }]
 }
 
 # The VxWorks SPARC simulator accepts only EM_SPARC executables and