diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-07 13:27:45 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-07 13:27:45 +0000 |
commit | 9dd71412e72c8960fec188773578aeffcb663cfb (patch) | |
tree | 237ccb99133c0a6b115c594981f93ed9d688628f /gcc/testsuite/lib | |
parent | 6d5d95d68499cdddcf35ea7cef4c23de68c540a1 (diff) | |
download | gcc-9dd71412e72c8960fec188773578aeffcb663cfb.tar.gz |
PR c++/60731
* lib/gcc-dg.exp (dg-build-dso): New.
(gcc-dg-test-1): Handle dg-do-what "dso".
* lib/target-supports.exp (add_options_for_dlopen): New.
(check_effective_target_dlopen): Use it.
* g++.dg/dso/dlclose1.C: New.
* g++.dg/dso/dlclose1-dso.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209187 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r-- | gcc/testsuite/lib/gcc-dg.exp | 26 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 9 |
2 files changed, 34 insertions, 1 deletions
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index f9d52bcf63d..89eec95a5f7 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -144,6 +144,11 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } { # The following line is needed for targets like the i960 where # the default output file is b.out. Sigh. } + "dso" { + set compile_type "executable" + set output_file "[file rootname [file tail $prog]].so" + set extra_tool_flags "$extra_tool_flags -fPIC -shared" + } "repo" { set compile_type "object" set output_file "[file rootname [file tail $prog]].o" @@ -181,6 +186,7 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } { lappend options "additional_flags=$extra_tool_flags" } + verbose "$target_compile $prog $output_file $compile_type $options" 4 set comp_output [$target_compile "$prog" "$output_file" "$compile_type" $options] # Look for an internal compiler error, which sometimes masks the fact @@ -208,6 +214,26 @@ proc gcc-dg-test { prog do_what extra_tool_flags } { return [gcc-dg-test-1 gcc_target_compile $prog $do_what $extra_tool_flags] } +# Usage: { dg-build-dso "file.ext" } +# Compiles the specified file into "file.so" (treating that compilation as +# a separate test) for use by the main test, and schedules it for removal +# when the main test is complete. The DSO source file should not use "dg-do". +# This relies on a couple of local variable names in dg-test. + +proc dg-build-dso { args } { + global dg-do-what-default + upvar prog main_file + upvar dg-final-code final-code + + set file [lindex $args 1] + set dir "[file dirname $main_file]" + set dg-do-what-default dso + dg-test -keep-output $dir/$file "" "" + + set output_file "[file rootname [file tail $file]].so" + append final-code "remove-build-file $output_file" +} + proc gcc-dg-prune { system text } { global additional_prunes diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 0d2ccd512bc..1a5c2fa1b97 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -746,7 +746,14 @@ proc check_effective_target_mmap {} { # Return 1 if the target supports dlopen, 0 otherwise. proc check_effective_target_dlopen {} { - return [check_function_available "dlopen"] + return [check_no_compiler_messages dlopen executable { + #include <dlfcn.h> + int main(void) { dlopen ("dummy.so", RTLD_NOW); } + } [add_options_for_dlopen ""]] +} + +proc add_options_for_dlopen { flags } { + return "$flags -ldl" } # Return 1 if the target supports clone, 0 otherwise. |