commit 03ae8dd2f9d2812b8d2744e8d78a3f6c4c65ed9b Author: Sandra Loosemore Date: Wed Sep 26 19:14:14 2018 -0700 Skip ifunc tests if no target support. 2018-09-26 Sandra Loosemore * lib/gdb.exp (skip_ifunc_tests): New. * gdb.base/gnu-ifunc.exp: Skip if no ifunc support. Handle other compile failures. * gdb.compile/compile-ifunc.exp: Skip if no ifunc support. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2b4b097..c30db8f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-09-26 Sandra Loosemore + + * lib/gdb.exp (skip_ifunc_tests): New. + * gdb.base/gnu-ifunc.exp: Skip if no ifunc support. Handle + other compile failures. + * gdb.compile/compile-ifunc.exp: Skip if no ifunc support. + 2018-09-26 Andrew Burgess * gdb.base/large-frame-1.c: New file. diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp index d6ec698..322de5a 100644 --- a/gdb/testsuite/gdb.base/gnu-ifunc.exp +++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp @@ -17,6 +17,10 @@ if {[skip_shlib_tests]} { return 0 } +if {[skip_ifunc_tests]} { + return 0 +} + standard_testfile .c set staticexecutable ${testfile}-static set staticbinfile [standard_output_file ${staticexecutable}] @@ -365,9 +369,10 @@ proc misc_tests {resolver_attr resolver_debug final_debug} { foreach_with_prefix resolver_attr {0 1} { foreach_with_prefix resolver_debug {0 1} { foreach_with_prefix final_debug {0 1} { - build $resolver_attr $resolver_debug $final_debug - misc_tests $resolver_attr $resolver_debug $final_debug - set-break $resolver_attr $resolver_debug $final_debug + if { [build $resolver_attr $resolver_debug $final_debug] != 0 } { + misc_tests $resolver_attr $resolver_debug $final_debug + set-break $resolver_attr $resolver_debug $final_debug + } } } } diff --git a/gdb/testsuite/gdb.compile/compile-ifunc.exp b/gdb/testsuite/gdb.compile/compile-ifunc.exp index 979e391..bb3af4d 100644 --- a/gdb/testsuite/gdb.compile/compile-ifunc.exp +++ b/gdb/testsuite/gdb.compile/compile-ifunc.exp @@ -13,6 +13,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +if {[skip_ifunc_tests]} { + return 0 +} + standard_testfile with_test_prefix "nodebug" { diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f32abfe..2cdc80a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2842,6 +2842,34 @@ gdb_caching_proc has_int128_cxx { return [gdb_int128_helper c++] } +# Return true if the IFUNC feature is unsupported. +gdb_caching_proc skip_ifunc_tests { + # Set up, compile, and execute a test program. + # Include the current process ID in the file names to prevent conflicts + # with invocations for multiple testsuites. + set src [standard_temp_file ifunc[pid].c] + set obj [standard_temp_file ifunc[pid].o] + + verbose -log "checking for ifunc support" + gdb_produce_source $src { + extern void f_ (); + typedef void F (void); + F* g (void) { return &f_; } + void f () __attribute__ ((ifunc ("g"))); + } + + set lines [gdb_compile $src $obj object {quiet}] + file delete $src + file delete $obj + + if ![string match "" $lines] then { + verbose -log "ifunc testfile compilation failed" + return 1 + } + verbose -log "ifunc testfile compilation successful" + return 0 +} + # Return whether we should skip tests for showing inlined functions in # backtraces. Requires get_compiler_info and get_debug_format.