1 # Copyright
(C
) 1993, 1994, 1997 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
2 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program; if not
, write to the Free Software
15 # Foundation
, Inc.
, 59 Temple Place
- Suite
330, Boston
, MA
02111-1307, USA.
17 # Please email
any bugs
, comments
, and
/or additions to this file to
:
18 # bug
-dejagnu@prep.ai.mit.edu
20 # This file was written by Rob Savoye
<rob@cygnus.com
>
21 # and extended by Ian Lance Taylor
<ian@cygnus.com
>
23 proc binutil_version
{ prog
} {
24 if ![is_remote host
] {
25 set path
[which $prog
];
26 if {$path
== 0} then {
27 perror
"$prog can't be run, file not found."
33 set state
[remote_exec host $prog
--version
];
34 set tmp
"[lindex $state 1]\n";
35 # Should find a way to discard constant parts
, keep whatever
's
36 # left, so the version string could be almost anything at all...
37 regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" "$tmp" version cyg number
38 if ![info exists number] then {
39 return "$path (no version number)\n"
41 return "$path $number\n"
45 # default_binutils_run
46 # run a program, returning the output
47 # sets binutils_run_failed if the program does not exist
49 proc default_binutils_run { prog progargs } {
50 global binutils_run_failed
53 set binutils_run_failed 0
55 if ![is_remote host] {
56 if {[which $prog] == 0} then {
57 perror "$prog does not exist"
58 set binutils_run_failed 1
63 send_log "$prog $progargs\n"
64 verbose "$prog $progargs"
66 # Gotta quote dollar-signs because they get mangled by the
68 regsub -all "\\$" "$progargs" "\\$" progargs
70 set state [remote_exec host $prog $progargs]
71 set exec_output [prune_warnings [lindex $state 1]];
72 if {![string match "" $exec_output]} then {
73 send_log "$exec_output\n"
74 verbose "$exec_output"
80 # default_binutils_assemble
83 proc default_binutils_assemble { source object } {
87 # The HPPA assembler syntax is a little different than most, to make
88 # the test source file assemble we need to run it through sed.
90 # This is a hack in that it won't scale well
if other targets need
91 # similar transformations to assemble. We
'll generalize the hack
92 # if/when other targets need similar handling.
93 if { [istarget "hppa*-*-*"] && ![istarget "*-*-linux*" ] } then {
94 set sed_file $srcdir/config/hppa.sed
95 send_log "sed -f $sed_file < $source > asm.s\n"
96 verbose "sed -f $sed_file < $source > asm.s"
97 catch "exec sed -f $sed_file < $source > asm.s";
101 set exec_output [target_assemble $source $object ""];
102 set exec_output [prune_warnings $exec_output]
104 if [string match "" $exec_output] {
107 send_log "$exec_output\n"
108 verbose "$exec_output"
109 perror "$source: assembly failed"
114 if ![info exists target_assemble] {
116 # Stolen from dejagnu/lib/target.exp--please remove after 1/1/98.
119 proc target_assemble { source destfile flags } {
120 return [default_target_assemble $source $destfile $flags];
123 proc default_target_assemble { source destfile flags } {
124 global AS_FOR_TARGET;
125 global ASFLAGS_FOR_TARGET;
127 if [info exists AS_FOR_TARGET] {
128 set AS "$AS_FOR_TARGET";
130 if ![board_info target exists assembler] {
133 set AS [board_info target assembler];
137 if [info exists ASFLAGS_FOR_TARGET] {
138 append flags " $ASFLAGS_FOR_TARGET";
141 if [is_remote host] {
142 set source [remote_download host $source];
147 set status [remote_exec host "$AS $source $flags -o $dest"]
148 if [is_remote host] {
149 remote_upload host $dest $destfile
152 set comp_output [prune_warnings [lindex $status 1]];
153 if { [lindex $status 0] != 0 } {
154 verbose -log "assembler exited with status [lindex $status 0]";
156 if { [lindex $status 1] != "" } {
157 verbose -log "assembler output is:\n[lindex $status 1]" 2;
159 return ${comp_output};