1 # Expect script for various DWARF tests.
2 # Copyright 2006 Free Software Foundation, Inc.
4 # This file is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
20 # Written by H.J. Lu (hongjiu.lu@intel.com)
23 # Exclude non-ELF targets.
29 # The following tests require running the executable generated by ld.
34 # Check if compiler works
35 if { [which $CC] == 0 } {
39 # Skip if -feliminate-dwarf2-dups isn't supported.
40 if ![ld_compile "$CC -g -feliminate-dwarf2-dups" $srcdir/$subdir/dummy.c tmpdir/dummy.o] {
46 "-s -shared" "-fPIC -g -feliminate-dwarf2-dups"
47 {dwarf1.c} {} "libdwarf1.so"}
51 {"Run with libdwarf1.so first"
52 "tmpdir/libdwarf1.so" ""
53 {dwarf1main.c} "dwarf1a" "dwarf1.out"
54 "-g -feliminate-dwarf2-dups"}
55 {"Run with libdwarf1.so last"
56 "tmpdir/dwarf1main.o tmpdir/libdwarf1.so" ""
57 {dummy.c} "dwarf1b" "dwarf1.out"
58 "-g -feliminate-dwarf2-dups"}
61 run_cc_link_tests $build_tests
62 run_ld_link_exec_tests [] $run_tests
69 set test "libdwarf1c.so"
70 set test_name "Strip -s $test"
73 if ![ld_simple_link $ld tmpdir/$test "-shared tmpdir/dwarf1.o"] {
74 unresolved "$test_name"
78 send_log "$NM -D tmpdir/$test > tmpdir/$test.exp\n"
79 catch "exec $NM -D tmpdir/$test > tmpdir/$test.exp" got
80 if ![string match "" $got] then {
82 unresolved "$test_name"
86 send_log "$prog -s tmpdir/$test\n"
87 catch "exec $prog -s tmpdir/$test" got
88 if ![string match "" $got] then {
94 send_log "$NM -D tmpdir/$test > tmpdir/$test.out\n"
95 catch "exec $NM -D tmpdir/$test > tmpdir/$test.out" got
96 if ![string match "" $got] then {
98 unresolved "$test_name"
102 if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
103 send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"