* ld-xtensa/coalesce.exp: Skip if target is not xtensa-*-*.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-xtensa / lcall.exp
CommitLineData
e0001a05
NC
1# Test Xtensa longcall optimization.
2# By David Heine, Tensilica, Inc.
3# Copyright 2002, 2003
4# Free Software Foundation, Inc.
5#
6# This file 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 2 of the License, or
9# (at your option) any later version.
10#
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.
15#
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
8fdeb6e3
BW
20if ![istarget "xtensa-*-*"] {
21 return
22}
23
e0001a05
NC
24set testname "LCALL"
25
26set OBJDUMPFLAGS "-dr"
27
28#
29# default_ld_objdump
30# run objdump on a file
31#
32proc default_ld_objdump { objdump object outputfile } {
33 global OBJDUMPFLAGS
34 global objdump_output
35 global host_triplet
36
37 if {[which $objdump] == 0} then {
38 perror "$objdump does not exist"
39 return 0
40 }
41
42 if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" }
43
44 verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile"
45
46 catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output
47 set exec_output [prune_warnings $exec_output]
48 if [string match "" $exec_output] then {
49 return 1
50 } else {
51 verbose -log "$exec_output"
52 perror "$object: objdump failed"
53 return 0
54 }
55}
56
57
58if ![ld_assemble $as $srcdir/$subdir/lcall1.s tmpdir/lcall1.o] {
59 unresolved $testname
60 return
61}
62if ![ld_assemble $as $srcdir/$subdir/lcall2.s tmpdir/lcall2.o] {
63 unresolved $testname
64 return
65}
66
67set object "tmpdir/lcall"
68set outputfile "$object.txt"
69
70if ![ld_simple_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] {
71 verbose -log "failure in ld"
72 fail $testname
73 return
74}
75
76if ![default_ld_objdump $objdump $object $outputfile ] {
77 verbose -log "failure in objdump"
78 fail $testname
79 return
80}
81
82set file [open $outputfile r]
83while { [gets $file line] != -1 } {
84 # verbose "$line" 2
85 if [regexp "l32r" $line] {
86 verbose -log "Found an l32r in the linked object"
87 verbose -log "$line"
88 fail $testname
89 }
90}
91close $file
92pass $testname
93
94
95set testname "LCALL2"
96set file [open $outputfile r]
97set found 0
98
99while { [gets $file line] != -1 } {
100 # verbose "$line" 2
101 if [regexp "^00000004 <label1>:" $line] {
102 set found 1
103 }
104}
105close $file
106if $found {
107 pass $testname
108} else {
109 fail $testname
110}
111
This page took 0.040251 seconds and 4 git commands to generate.