From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id A2442386F81E for ; Sat, 2 May 2020 08:57:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A2442386F81E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 30DA4AC26 for ; Sat, 2 May 2020 08:57:38 +0000 (UTC) Date: Sat, 2 May 2020 10:57:36 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix i386-mpx.exp compilation warnings Message-ID: <20200502085734.GA27516@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-28.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Sat, 02 May 2020 08:57:40 -0000 Hi, When running test-case gdb.arch/i386-mpx.exp with gcc-10, we get: ... Running src/gdb/testsuite/gdb.arch/i386-mpx.exp ... gdb compile failed, xgcc: warning: switch '-mmpx' is no longer supported xgcc: warning: switch '-fcheck-pointer-bounds' is no longer supported ... The test-case uses a combination of options, -mmpx and -fcheck-pointer-bounds. The -fcheck-pointer-bounds option requires the -mmpx option: ... $ gcc -fcheck-pointer-bounds ~/hello.c hello.c:1:0: warning: Pointer Checker requires MPX support on this target. \ Use -mmpx options to enable MPX. #include cc1: error: ‘-fcheck-pointer-bounds’ is not supported for this target ... Both options is no longer supported in gcc-9. Fix the warnings by testing if the option combination is supported. Tested on x86_64-linux, with gcc-7.5.0 and gcc-10.0.1. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix i386-mpx.exp compilation warnings gdb/testsuite/ChangeLog: 2020-05-02 Tom de Vries * lib/gdb.exp (supports_mpx_check_pointer_bounds): New proc. * gdb.arch/i386-mpx-call.exp: Use supports_mpx_check_pointer_bounds. * gdb.arch/i386-mpx-map.exp: Same. * gdb.arch/i386-mpx-sigsegv.exp: Same. * gdb.arch/i386-mpx-simple_segv.exp: Same. * gdb.arch/i386-mpx.exp: Same. --- gdb/testsuite/gdb.arch/i386-mpx-call.exp | 4 ++++ gdb/testsuite/gdb.arch/i386-mpx-map.exp | 4 ++++ gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp | 4 ++++ gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp | 4 ++++ gdb/testsuite/gdb.arch/i386-mpx.exp | 4 ++++ gdb/testsuite/lib/gdb.exp | 12 ++++++++++++ 6 files changed, 32 insertions(+) diff --git a/gdb/testsuite/gdb.arch/i386-mpx-call.exp b/gdb/testsuite/gdb.arch/i386-mpx-call.exp index b11adfc7b87..41abbeebcf9 100644 --- a/gdb/testsuite/gdb.arch/i386-mpx-call.exp +++ b/gdb/testsuite/gdb.arch/i386-mpx-call.exp @@ -21,6 +21,10 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { standard_testfile +if { ![supports_mpx_check_pointer_bounds] } { + return -1 +} + set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat" if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ diff --git a/gdb/testsuite/gdb.arch/i386-mpx-map.exp b/gdb/testsuite/gdb.arch/i386-mpx-map.exp index 3cde42f6c4b..995aaa1eb09 100644 --- a/gdb/testsuite/gdb.arch/i386-mpx-map.exp +++ b/gdb/testsuite/gdb.arch/i386-mpx-map.exp @@ -23,6 +23,10 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { standard_testfile +if { ![supports_mpx_check_pointer_bounds] } { + return -1 +} + set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/" if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ diff --git a/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp b/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp index 72c9ec3d1ad..5e43f93f360 100644 --- a/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp +++ b/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp @@ -23,6 +23,10 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { standard_testfile +if { ![supports_mpx_check_pointer_bounds] } { + return -1 +} + set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/" if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ diff --git a/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp b/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp index 806d7d61e14..e7078145ecc 100644 --- a/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp +++ b/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp @@ -29,6 +29,10 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { standard_testfile +if { ![supports_mpx_check_pointer_bounds] } { + return -1 +} + set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/" if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ diff --git a/gdb/testsuite/gdb.arch/i386-mpx.exp b/gdb/testsuite/gdb.arch/i386-mpx.exp index 2cac70f42fa..158550a7b5d 100644 --- a/gdb/testsuite/gdb.arch/i386-mpx.exp +++ b/gdb/testsuite/gdb.arch/i386-mpx.exp @@ -27,6 +27,10 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { return } +if { ![supports_mpx_check_pointer_bounds] } { + return -1 +} + set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/" if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index b72ce0cda7f..37326144141 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -7007,6 +7007,18 @@ gdb_caching_proc supports_statement_frontiers { } executable "additional_flags=-gstatement-frontiers"] } +# Return 1 if compiler supports -mmpx -fcheck-pointer-bounds. Otherwise, +# return 0. + +gdb_caching_proc supports_mpx_check_pointer_bounds { + set flags "additional_flags=-mmpx additional_flags=-fcheck-pointer-bounds" + return [gdb_can_simple_compile supports_mpx_check_pointer_bounds { + int main () { + return 0; + } + } executable $flags] +} + # Return 1 if symbols were read in using -readnow. Otherwise, return 0. proc readnow { } {