From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 86AB33858CDA for ; Mon, 18 Jul 2022 04:14:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 86AB33858CDA Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 98BFB20775 for ; Mon, 18 Jul 2022 04:14:13 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7853813754 for ; Mon, 18 Jul 2022 04:14:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hPIZHBXe1GKjMwAAMHmgww (envelope-from ) for ; Mon, 18 Jul 2022 04:14:13 +0000 Date: Mon, 18 Jul 2022 06:14:12 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix regression in step-indirect-call-thunk.exp with gcc 7 Message-ID: <20220718041410.GA17252@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2022 04:14:16 -0000 Hi, 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. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix regression in step-indirect-call-thunk.exp with gcc 7 --- 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