1 # Basic expect script for LD Regression Tests
2 # Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation
4 # This file is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Written by Jeffrey Wheat (cassidy@cygnus.com)
21 if ![info exists ld] then {
22 set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
25 if ![info exists as] then {
26 set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
29 if ![info exists nm] then {
30 set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
33 if ![info exists objdump] then {
34 set objdump [findfile $base_dir/../binutils/objdump]
37 if ![info exists objcopy] then {
38 set objcopy [findfile $base_dir/../binutils/objcopy]
41 if ![info exists ar] then {
42 set ar [findfile $base_dir/../binutils/ar]
45 if ![info exists strip] then {
46 set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
49 if {![file isdirectory tmpdir]} then {
50 catch "exec mkdir tmpdir" status
53 # Make a symlink from tmpdir/as to the assembler in the build tree, so
54 # that we can use a -B option to gcc to force it to use the newly
56 if {![file isdirectory tmpdir/gas]} then {
57 catch "exec mkdir tmpdir/gas" status
58 catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status
60 set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
62 # load the utility procedures
65 proc get_link_files {varname} {
70 if ![info exists $varname] {
71 set status [catch "exec sh -c \"host=$target_triplet && CC=$CC && . $srcdir/../configure.host && eval echo \\$$varname\"" result]
72 if $status { error "Error getting native link files: $result" }
77 proc get_target_emul {} {
80 set status [catch "exec sh -c \"targ=$target_triplet && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
81 if $status { error "Error getting emulation name: $result" }
86 foreach x {HOSTING_CRT0 HOSTING_LIBS} {
90 foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
92 if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
95 # ld_version -- extract and print the version number of ld compiler (GCC)
99 default_ld_version $ld
103 # ld_exit -- just a stub for ld
112 proc ld_start { ld target } {
118 # link an object using relocation
120 proc ld_relocate { ld target objects } {
121 default_ld_relocate $ld $target $objects
126 # link a program using ld
128 proc ld_link { ld target objects } {
129 default_ld_link $ld $target $objects
134 # link a program using ld, without including any libraries
136 proc ld_simple_link { ld target objects } {
137 default_ld_simple_link $ld $target $objects
142 # compile an object using $cc
144 proc ld_compile { cc source object } {
145 default_ld_compile $cc $source $object
152 proc ld_assemble { as source object } {
153 default_ld_assemble $as $source $object
160 proc ld_nm { nm object } {
161 default_ld_nm $nm $object
166 # execute ithe target
168 proc ld_exec { target output } {
169 default_ld_exec $target $output