public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix i386-mpx.exp compilation warnings
@ 2020-05-02  8:56 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-05-02  8:56 UTC (permalink / raw)
  To: gdb-cvs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 6226 bytes --]

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

commit 5beb4d17717570c28e9bf290c64428fda65095b9
Author: Tom de Vries <tdevries@suse.de>
Date:   Sat May 2 10:56:48 2020 +0200

    [gdb/testsuite] Fix i386-mpx.exp compilation warnings
    
    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 <stdio.h>
    
    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.
    
    gdb/testsuite/ChangeLog:
    
    2020-05-02  Tom de Vries  <tdevries@suse.de>
    
            * 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.

Diff:
---
 gdb/testsuite/ChangeLog                         |  9 +++++++++
 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 ++++++++++++
 7 files changed, 41 insertions(+)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e741fd6a7d8..986e3be34bc 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2020-05-02  Tom de Vries  <tdevries@suse.de>
+
+	* 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.
+
 2020-05-02  Tom de Vries  <tdevries@suse.de>
 
 	* gdb.base/psym-external-decl.c (main): Add use of variable aaa.
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 { } {


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

only message in thread, other threads:[~2020-05-02  8:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-02  8:56 [binutils-gdb] [gdb/testsuite] Fix i386-mpx.exp compilation warnings 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).