* elf32-ppc.c (ppc_elf_check_relocs): Set pointer_equality_needed
[binutils.git] / ld / testsuite / ld-elf / dwarf.exp
blobc31323608119569e39ed467f515749f80497ed71
1 # Expect script for various DWARF tests.
2 # Copyright 2006, 2007 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,
19 # MA 02110-1301, USA.
23 # Written by H.J. Lu (hongjiu.lu@intel.com)
26 # Exclude non-ELF targets.
28 if ![is_elf_format] {
29 return
32 # The following tests require running the executable generated by ld.
33 if ![isnative] {
34 return
37 # Check if compiler works
38 if { [which $CC] == 0 } {
39 return
42 # Skip if -feliminate-dwarf2-dups isn't supported.
43 if ![ld_compile "$CC -g -feliminate-dwarf2-dups" $srcdir/$subdir/dummy.c tmpdir/dummy.o] {
44 return
47 set build_tests {
48 {"Build libdwarf1.so"
49 "-s -shared" "-fPIC -g -feliminate-dwarf2-dups"
50 {dwarf1.c} {} "libdwarf1.so"}
53 set run_tests {
54 {"Run with libdwarf1.so first"
55 "tmpdir/libdwarf1.so" ""
56 {dwarf1main.c} "dwarf1a" "dwarf1.out"
57 "-g -feliminate-dwarf2-dups"}
58 {"Run with libdwarf1.so last"
59 "tmpdir/dwarf1main.o tmpdir/libdwarf1.so" ""
60 {dummy.c} "dwarf1b" "dwarf1.out"
61 "-g -feliminate-dwarf2-dups"}
64 run_cc_link_tests $build_tests
65 run_ld_link_exec_tests [] $run_tests
67 proc strip_test {} {
68 global ld
69 global strip
70 global NM
72 set test "libdwarf1c.so"
73 set test_name "Strip -s $test"
74 set prog $strip
76 if ![ld_simple_link $ld tmpdir/$test "-shared tmpdir/dwarf1.o"] {
77 unresolved "$test_name"
78 return
81 send_log "$NM -D tmpdir/$test > tmpdir/$test.exp\n"
82 catch "exec $NM -D tmpdir/$test > tmpdir/$test.exp" got
83 if ![string match "" $got] then {
84 send_log "$got\n"
85 unresolved "$test_name"
86 return
89 send_log "$prog -s tmpdir/$test\n"
90 catch "exec $prog -s tmpdir/$test" got
91 if ![string match "" $got] then {
92 send_log "$got\n"
93 fail "$test_name"
94 return
97 send_log "$NM -D tmpdir/$test > tmpdir/$test.out\n"
98 catch "exec $NM -D tmpdir/$test > tmpdir/$test.out" got
99 if ![string match "" $got] then {
100 send_log "$got\n"
101 unresolved "$test_name"
102 return
105 if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
106 send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"
107 fail "$test_name"
108 return
111 pass "$test_name"
114 strip_test