public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix gdb.reverse/step-indirect-call-thunk.exp with -fcf-protection
@ 2022-12-30 15:48 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-12-30 15:48 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d6246a8730fad9edcb972c1f689a13bb16640483

commit d6246a8730fad9edcb972c1f689a13bb16640483
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Dec 30 16:48:07 2022 +0100

    [gdb/testsuite] Fix gdb.reverse/step-indirect-call-thunk.exp with -fcf-protection
    
    On Ubuntu 22.04.1 x86_64, I run into:
    ...
    gdb.reverse/step-indirect-call-thunk.c: In function 'inc':^M
    gdb.reverse/step-indirect-call-thunk.c:22:1: error: '-mindirect-branch' and \
      '-fcf-protection' are not compatible^M
       22 | {                /* inc.1 */^M
          | ^^M
    ...
    
    Fix this by forcing -fcf-protection=none, if supported.
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
index 3f1f5381f09..1234a042645 100644
--- a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
+++ b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
@@ -20,9 +20,18 @@ if { ![supports_reverse] } {
 
 standard_testfile
 
-set cflags "-mindirect-branch=thunk -mfunction-return=thunk"
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
-        [list debug "additional_flags=$cflags"]] } {
+set cflags {}
+lappend cflags debug
+lappend cflags additional_flags=-mindirect-branch=thunk
+lappend cflags additional_flags=-mfunction-return=thunk
+
+set fcf_protection_none additional_flags=-fcf-protection=none
+if { [gdb_can_simple_compile fcf-protection-none {int main () { return 0; }} \
+	  executable $fcf_protection_none] } {
+    lappend cflags $fcf_protection_none
+}
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile $cflags] } {
     return -1
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-30 15:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-30 15:48 [binutils-gdb] [gdb/testsuite] Fix gdb.reverse/step-indirect-call-thunk.exp with -fcf-protection Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).