1 # Expect script for various DWARF tests.
2 # Copyright (C) 2006-2017 Free Software Foundation, Inc.
4 # This file is part of the GNU Binutils.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23 # Written by H.J. Lu (hongjiu.lu@intel.com)
26 # Exclude non-ELF targets.
32 # Skip targets where -shared is not supported
34 if ![check_shared_lib_support] {
38 # Check if compiler works
39 if { [which $CC] == 0 } {
43 # Skip if -feliminate-dwarf2-dups isn't supported.
44 if ![ld_compile "$CC -g -feliminate-dwarf2-dups" $srcdir/$subdir/dummy.c tmpdir/dummy.o] {
50 "-s -shared" "-fPIC -g -feliminate-dwarf2-dups"
51 {dwarf1.c} {} "libdwarf1.so"}
55 {"Run with libdwarf1.so first"
56 "-Wl,--no-as-needed tmpdir/libdwarf1.so" ""
57 {dwarf1main.c} "dwarf1a" "dwarf1.out"
58 "-g -feliminate-dwarf2-dups"}
59 {"Run with libdwarf1.so last"
60 "tmpdir/dwarf1main.o tmpdir/libdwarf1.so" ""
61 {dummy.c} "dwarf1b" "dwarf1.out"
62 "-g -feliminate-dwarf2-dups"}
65 run_cc_link_tests $build_tests
66 run_ld_link_exec_tests $run_tests
73 set test "libdwarf1c.so"
74 set test_name "Strip -s $test"
77 if ![ld_link $ld tmpdir/$test "-shared tmpdir/dwarf1.o"] {
78 unresolved "$test_name"
82 send_log "$NM -D tmpdir/$test > tmpdir/$test.exp\n"
83 catch "exec $NM -D tmpdir/$test > tmpdir/$test.exp" got
84 if ![string match "" $got] then {
86 unresolved "$test_name"
90 send_log "$prog -s tmpdir/$test\n"
91 catch "exec $prog -s tmpdir/$test" got
92 if ![string match "" $got] then {
98 send_log "$NM -D tmpdir/$test > tmpdir/$test.out\n"
99 catch "exec $NM -D tmpdir/$test > tmpdir/$test.out" got
100 if ![string match "" $got] then {
102 unresolved "$test_name"
106 if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
107 send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"