]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-xtensa/lcall.exp
ChangeLog rotatation and copyright year update
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-xtensa / lcall.exp
CommitLineData
e0001a05
NC
1# Test Xtensa longcall optimization.
2# By David Heine, Tensilica, Inc.
b90efa5b 3# Copyright (C) 2002-2015 Free Software Foundation, Inc.
e0001a05 4#
f96b4a7b
NC
5# This file is part of the GNU Binutils.
6#
7# This program is free software; you can redistribute it and/or modify
e0001a05 8# it under the terms of the GNU General Public License as published by
f96b4a7b 9# the Free Software Foundation; either version 3 of the License, or
e0001a05
NC
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
f96b4a7b
NC
19# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20# MA 02110-1301, USA.
e0001a05 21
f8a52b59 22if ![istarget "xtensa*-*-*"] {
8fdeb6e3
BW
23 return
24}
25
e0001a05
NC
26set testname "LCALL"
27
28set OBJDUMPFLAGS "-dr"
29
30#
31# default_ld_objdump
32# run objdump on a file
33#
34proc default_ld_objdump { objdump object outputfile } {
35 global OBJDUMPFLAGS
36 global objdump_output
37 global host_triplet
38
39 if {[which $objdump] == 0} then {
40 perror "$objdump does not exist"
41 return 0
42 }
43
44 if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" }
45
46 verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile"
47
48 catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output
49 set exec_output [prune_warnings $exec_output]
50 if [string match "" $exec_output] then {
51 return 1
52 } else {
53 verbose -log "$exec_output"
54 perror "$object: objdump failed"
55 return 0
56 }
57}
58
59
60if ![ld_assemble $as $srcdir/$subdir/lcall1.s tmpdir/lcall1.o] {
61 unresolved $testname
62 return
63}
64if ![ld_assemble $as $srcdir/$subdir/lcall2.s tmpdir/lcall2.o] {
65 unresolved $testname
66 return
67}
68
69set object "tmpdir/lcall"
70set outputfile "$object.txt"
71
72if ![ld_simple_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] {
73 verbose -log "failure in ld"
74 fail $testname
75 return
76}
77
78if ![default_ld_objdump $objdump $object $outputfile ] {
79 verbose -log "failure in objdump"
80 fail $testname
81 return
82}
83
84set file [open $outputfile r]
85while { [gets $file line] != -1 } {
86 # verbose "$line" 2
87 if [regexp "l32r" $line] {
88 verbose -log "Found an l32r in the linked object"
89 verbose -log "$line"
90 fail $testname
91 }
92}
93close $file
94pass $testname
95
96
97set testname "LCALL2"
98set file [open $outputfile r]
99set found 0
100
101while { [gets $file line] != -1 } {
102 # verbose "$line" 2
103 if [regexp "^00000004 <label1>:" $line] {
104 set found 1
105 }
106}
107close $file
108if $found {
109 pass $testname
110} else {
111 fail $testname
112}
113