re PR target/41605 (Static linking of libgcc/libgfortran/libstdc++ can cause inconsis...
[gcc.git] / libstdc++-v3 / testsuite / libstdc++-abi / abi.exp
1 # Copyright (C) 2005, 2009 Free Software Foundation, Inc.
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
16
17 # If there is no baseline file, or we can't find the library, skip
18 # this test. Or, hey, if we don't support this kind of symbol
19 # versioning test: don't run it.
20
21 if { [string match "*-*-darwin*" $target_triplet] } {
22 set lib $blddir/src/.libs/libstdc++.dylib
23 } else {
24 set lib $blddir/src/.libs/libstdc++.so
25 }
26
27 set baseline_subdir "[eval exec $cxx --print-multi-dir]"
28
29 # Build the support objects.
30 v3-build_support
31
32 if { (${v3-symver} == 0) || ![info exists baseline_dir] \
33 || ![file exists $baseline_dir] \
34 || ![file exists $lib] } {
35 return
36 }
37
38 set baseline_file \
39 [file join $baseline_dir $baseline_subdir "baseline_symbols.txt"]
40 # If there is no ABI-specific reference file use that of the default ABI.
41 if ![file exists $baseline_file] {
42 set baseline_file [file join $baseline_dir "baseline_symbols.txt"]
43 }
44 if ![file exists $baseline_file] {
45 return
46 }
47 send_log "Checking $lib against $baseline_file\n"
48
49 # Figure out what symbols are defined by the active build of the library.
50 remote_exec "build" "$srcdir/../scripts/extract_symvers" \
51 [list $lib "current_symbols.txt"]
52
53 # Build the abi_check program.
54 if { [v3_target_compile "$srcdir/util/testsuite_abi_check.cc" "abi_check" \
55 "executable" [list "additional_flags=-w"]] != "" } {
56 error "could not compile testsuite_abi_check.cc"
57 }
58
59 remote_download "target" $baseline_file "baseline_symbols.txt"
60 remote_download "target" "current_symbols.txt" "current_symbols.txt"
61 set result [${tool}_load "./abi_check" \
62 [list "--check-verbose" "current_symbols.txt" \
63 "baseline_symbols.txt"]]
64 [lindex $result 0] "abi_check"