1 # Basic expect script for LD Regression Tests
2 # Copyright 1993, 1994, 1995, 1997, 1998, 1999
3 # Free Software Foundation, Inc.
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # Written by Jeffrey Wheat (cassidy@cygnus.com)
22 if ![info exists ld] then {
23 set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
26 if ![info exists as] then {
27 set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
30 if ![info exists nm] then {
31 set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
34 if ![info exists objdump] then {
35 set objdump [findfile $base_dir/../binutils/objdump]
38 if ![info exists objcopy] then {
39 set objcopy [findfile $base_dir/../binutils/objcopy]
42 if ![info exists ar] then {
43 set ar [findfile $base_dir/../binutils/ar]
46 if ![info exists strip] then {
47 set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
50 if {![file isdirectory tmpdir]} then {
51 catch "exec mkdir tmpdir" status
54 # Make a symlink from tmpdir/as to the assembler in the build tree, so
55 # that we can use a -B option to gcc to force it to use the newly
57 if {![file isdirectory tmpdir/gas]} then {
58 catch "exec mkdir tmpdir/gas" status
59 catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status
61 set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
63 # load the utility procedures
66 proc get_link_files {varname} {
71 if ![info exists $varname] {
72 set status [catch "exec sh -c \"host='$target_triplet' && CC='$CC' && . $srcdir/../configure.host && eval echo \\$$varname\"" result]
73 if $status { error "Error getting native link files: $result" }
78 proc get_target_emul {} {
81 set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
82 if $status { error "Error getting emulation name: $result" }
87 foreach x {HOSTING_CRT0 HOSTING_LIBS} {
91 foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
93 if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
96 # ld_version -- extract and print the version number of ld compiler (GCC)
100 default_ld_version $ld
104 # ld_exit -- just a stub for ld
113 proc ld_start { ld target } {
119 # link an object using relocation
121 proc ld_relocate { ld target objects } {
122 default_ld_relocate $ld $target $objects
127 # link a program using ld
129 proc ld_link { ld target objects } {
130 default_ld_link $ld $target $objects
135 # link a program using ld, without including any libraries
137 proc ld_simple_link { ld target objects } {
138 default_ld_simple_link $ld $target $objects
143 # compile an object using $cc
145 proc ld_compile { cc source object } {
146 default_ld_compile $cc $source $object
153 proc ld_assemble { as source object } {
154 default_ld_assemble $as $source $object
161 proc ld_nm { nm object } {
162 default_ld_nm $nm $object
167 # execute ithe target
169 proc ld_exec { target output } {
170 default_ld_exec $target $output