From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 2EE4D3858CDA; Mon, 18 Jul 2022 04:13:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EE4D3858CDA Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix regression in step-indirect-call-thunk.exp with gcc 7 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 68a5118c481da16f81874a92f4daaab4dcdc5d89 X-Git-Newrev: 9d9dd861e9815829124a4413f0446e3bcc119dca Message-Id: <20220718041348.2EE4D3858CDA@sourceware.org> Date: Mon, 18 Jul 2022 04:13:48 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2022 04:13:48 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D9d9dd861e981= 5829124a4413f0446e3bcc119dca commit 9d9dd861e9815829124a4413f0446e3bcc119dca Author: Tom de Vries Date: Mon Jul 18 06:13:45 2022 +0200 [gdb/testsuite] Fix regression in step-indirect-call-thunk.exp with gcc= 7 =20 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=3Dnone'; did you mean '-flto-partition=3Dnone'? UNTESTED: gdb.base/step-indirect-call-thunk.exp: failed to prepare ... =20 The problem is that -fcf-protection is supported starting gcc 8, but I'= m using system gcc 7.5.0. =20 Fix this by only adding -fcf-protection=3Dnone for gcc 8 and later. =20 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/test= suite/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 } =20 -set cflags "-mindirect-branch=3Dthunk -mfunction-return=3Dthunk -fcf-prote= ction=3Dnone" +set cflags "-mindirect-branch=3Dthunk -mfunction-return=3Dthunk" + +if { [gcc_major_version] >=3D 8 } { + append cflags " -fcf-protection=3Dnone" +} if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ [list debug "additional_flags=3D$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 ""] } =20 +# 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