public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/testsuite] Fix regression in step-indirect-call-thunk.exp with gcc 7
Date: Mon, 18 Jul 2022 04:13:48 +0000 (GMT)	[thread overview]
Message-ID: <20220718041348.2EE4D3858CDA@sourceware.org> (raw)

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

commit 9d9dd861e9815829124a4413f0446e3bcc119dca
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Jul 18 06:13:45 2022 +0200

    [gdb/testsuite] Fix regression in step-indirect-call-thunk.exp with gcc 7
    
    Since commit 43127ae5714 ("Fix gdb.base/step-indirect-call-thunk.exp") I run
    into:
    ...
    gdb compile failed, gcc: error: unrecognized command line option \
      '-fcf-protection=none'; did you mean '-flto-partition=none'?
    UNTESTED: gdb.base/step-indirect-call-thunk.exp: failed to prepare
    ...
    
    The problem is that -fcf-protection is supported starting gcc 8, but I'm using
    system gcc 7.5.0.
    
    Fix this by only adding -fcf-protection=none for gcc 8 and later.
    
    Tested on x86_64-linux, with gcc 7.5.0, 8.2.1 and 12.1.1.

Diff:
---
 gdb/testsuite/gdb.base/step-indirect-call-thunk.exp |  6 +++++-
 gdb/testsuite/lib/gdb.exp                           | 11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
index 7c1b53c99be..c4f69adc9b2 100644
--- a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
+++ b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
@@ -19,7 +19,11 @@ if { ![istarget "x86*"] } {
     return
 }
 
-set cflags "-mindirect-branch=thunk -mfunction-return=thunk -fcf-protection=none"
+set cflags "-mindirect-branch=thunk -mfunction-return=thunk"
+
+if { [gcc_major_version] >= 8 } {
+    append cflags " -fcf-protection=none"
+}
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
         [list debug "additional_flags=$cflags"]] } {
     return -1
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 698dd14504e..5d6f1266b0f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -8529,6 +8529,17 @@ gdb_caching_proc supports_gnuc {
     return [gdb_simple_compile $me $src object ""]
 }
 
+# Return 1 if compiler supports __GNUC__, otherwise return 0.
+gdb_caching_proc supports_gnuc {
+    set me "supports_gnuc"
+    set src {
+	#ifndef __GNUC__
+	#error "No gnuc"
+	#endif
+    }
+    return [gdb_simple_compile $me $src object ""]
+}
+
 # Return 1 if target supports mpx, otherwise return 0.
 gdb_caching_proc have_mpx {
     global srcdir


                 reply	other threads:[~2022-07-18  4:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220718041348.2EE4D3858CDA@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).