]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix i386-mpx.exp compilation warnings
authorTom de Vries <tdevries@suse.de>
Sat, 2 May 2020 08:56:48 +0000 (10:56 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 2 May 2020 08:56:48 +0000 (10:56 +0200)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/i386-mpx-call.exp
gdb/testsuite/gdb.arch/i386-mpx-map.exp
gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp
gdb/testsuite/gdb.arch/i386-mpx.exp
gdb/testsuite/lib/gdb.exp

index e741fd6a7d8f9f9cbb9813784a2e7a1234441de8..986e3be34bcf3cf40493ec9c48b52de37a5e56ec 100644 (file)
@@ -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.
index b11adfc7b87692299a6838fd00f7a86e97aa37c7..41abbeebcf95ebdec124594136ef361d8d013dda 100644 (file)
@@ -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} \
index 3cde42f6c4bad89e0876dcfe96e4a82ba6fa3cbe..995aaa1eb095c8f5d080f2aceb423c7ca92f5559 100644 (file)
@@ -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} \
index 72c9ec3d1ad8ee57f59f4b969d5735450032b0f3..5e43f93f3604622d0405c48b9fa05d3d8a9ccdd3 100644 (file)
@@ -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} \
index 806d7d61e143fe9a8c1d0cb686758e9c15629396..e7078145ecc433e82129fd0067f5e27fb579f5eb 100644 (file)
@@ -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} \
index 2cac70f42fa5aa540264efc659bf5fc27d9816cf..158550a7b5d4c0efe53e00733d9965cd9053a45d 100644 (file)
@@ -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} \
index b72ce0cda7fad9833af3dbe388eed86afdafdad0..3732614414181b650164bd5346adf477d175eea0 100644 (file)
@@ -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 { } {