1 # Test Xtensa longcall optimization.
2 # By David Heine, Tensilica, Inc.
3 # Copyright (C) 2002-2017 Free Software Foundation, Inc.
5 # This file is part of the GNU Binutils.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
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.
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
19 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 if ![istarget "xtensa*-*-*"] {
28 set OBJDUMPFLAGS "-dr"
32 # run objdump on a file
34 proc default_ld_objdump { objdump object outputfile } {
39 if {[which $objdump] == 0} then {
40 perror "$objdump does not exist"
44 if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" }
46 verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile"
48 catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output
49 set exec_output [prune_warnings $exec_output]
50 if [string match "" $exec_output] then {
53 verbose -log "$exec_output"
54 perror "$object: objdump failed"
60 if ![ld_assemble $as $srcdir/$subdir/lcall1.s tmpdir/lcall1.o] {
64 if ![ld_assemble $as $srcdir/$subdir/lcall2.s tmpdir/lcall2.o] {
69 set object "tmpdir/lcall"
70 set outputfile "$object.txt"
72 if ![ld_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] {
73 verbose -log "failure in ld"
78 if ![default_ld_objdump $objdump $object $outputfile ] {
79 verbose -log "failure in objdump"
84 set file [open $outputfile r]
85 while { [gets $file line] != -1 } {
87 if [regexp "l32r" $line] {
88 verbose -log "Found an l32r in the linked object"
98 set file [open $outputfile r]
101 while { [gets $file line] != -1 } {
103 if [regexp "^00000004 <label1>:" $line] {