aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/lib
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-09-28 00:06:27 +0000
committerIan Lance Taylor <ian@airs.com>1994-09-28 00:06:27 +0000
commit9de5523bb6f20557d5bc61697293be73233f8368 (patch)
treed6fd773ca0827570e3a1278e392084cfa8e43609 /ld/testsuite/lib
parent8352254c2ee7cb1ffcf434550c177b06c54e4202 (diff)
downloadgdb-9de5523bb6f20557d5bc61697293be73233f8368.zip
gdb-9de5523bb6f20557d5bc61697293be73233f8368.tar.gz
gdb-9de5523bb6f20557d5bc61697293be73233f8368.tar.bz2
* ld.scripts: New directory.
* ld.scripts/defined.exp, ld.scripts/defined.s: New files. * ld.scripts/defined.t: New file. * lib/ld.exp (default_ld_simple_link): New function. (default_ld_assemble, default_ld_nm): New functions. * config/default.exp: Rename from unix-ld.exp. (ld_simple_link, ld_assemble, ld_nm): New functions.
Diffstat (limited to 'ld/testsuite/lib')
-rw-r--r--ld/testsuite/lib/ld.exp90
1 files changed, 90 insertions, 0 deletions
diff --git a/ld/testsuite/lib/ld.exp b/ld/testsuite/lib/ld.exp
index ee395c2..039bee6 100644
--- a/ld/testsuite/lib/ld.exp
+++ b/ld/testsuite/lib/ld.exp
@@ -75,6 +75,30 @@ proc default_ld_link { ld target objects } {
}
#
+# default_ld_simple_link
+# link a program using ld, without including any libraries
+#
+proc default_ld_simple_link { ld target objects } {
+
+ if { [file exists $ld] == 0 } then {
+ perror "$ld does not exist"
+ return 0
+ }
+
+ send_log "$ld -o $target $objects\n"
+ verbose "$ld -o $target $objects"
+
+ catch "exec $ld -o $target $objects" exec_output
+ if [string match "" $exec_output] then {
+ return 1
+ } else {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ return 0
+ }
+}
+
+#
# default_ld_compile
# compile an object using cc
#
@@ -103,6 +127,72 @@ proc default_ld_compile { cc source object } {
}
#
+# default_ld_assemble
+# assemble a file
+#
+proc default_ld_assemble { as source object } {
+ global ASFLAGS
+
+ if {[which $as] == 0} then {
+ perror "$as does not exist"
+ return 0
+ }
+
+ if ![info exists ASFLAGS] { set ASFLAGS "" }
+
+ send_log "$as $ASFLAGS -o $object $source\n"
+ verbose "$as $ASFLAGS -o $object $source"
+
+ catch "exec $as $ASFLAGS -o $object $source" exec_output
+ if [string match "" $exec_output] then {
+ return 1
+ } else {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ perror "$source: assembly failed"
+ return 0
+ }
+}
+
+#
+# default_ld_nm
+# run nm on a file, putting the result in the array nm_output
+#
+proc default_ld_nm { nm object } {
+ global NMFLAGS
+ global nm_output
+
+ if {[which $nm] == 0} then {
+ perror "$nm does not exist"
+ return 0
+ }
+
+ if ![info exists NMFLAGS] { set NMFLAGS "" }
+
+ send_log "$nm $NMFLAGS $object >tmpdir/nm.out\n"
+ verbose "$nm $NMFLAGS $object >tmpdir/nm.out"
+
+ catch "exec $nm $NMFLAGS $object >tmpdir/nm.out" exec_output
+ if [string match "" $exec_output] then {
+ set file [open tmpdir/nm.out r]
+ while { [gets $file line] != -1 } {
+ verbose "$line" 2
+ if [regexp "^(\[0-9a-fA-F\]+) \[a-zA-Z0-9\] (.+)$" $line whole value name] {
+ verbose "Setting nm_output($name) to 0x$value" 2
+ set nm_output($name) 0x$value
+ }
+ }
+ close $file
+ return 1
+ } else {
+ send_log "$exec_output\n"
+ verbose $exec_output
+ perror "$object: nm failed"
+ return 0
+ }
+}
+
+#
# simple_diff
# compares two files line-by-line
# returns differences if exist