* 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.
lib
ld.bootstrap
ld.cdtest
+ld.scripts
Things-to-lose:
Tue Sep 27 14:59:51 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
+ * 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.
+
* config/unix-ld.exp: Set ld using findfile.
* lib/ld.exp (default_ld_relocate): Return a value. Change format
of log messages.
Things-to-keep:
-unix-ld.exp
+default.exp
Things-to-lose:
--- /dev/null
+#
+# Expect script for LD Regression Tests
+# Copyright (C) 1993 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#
+# $Id$
+#
+# Written by Jeffrey Wheat (cassidy@cygnus.com)
+#
+
+if ![info exists ld] then {
+ set ld [findfile $objdir/ld.new $objdir/ld.new [transform ld]]
+}
+
+# load the utility procedures
+load_lib ld.exp
+
+#
+# ld_version -- extract and print the version number of ld compiler (GCC)
+#
+proc ld_version {} {
+ global ld
+ default_ld_version $ld
+}
+
+#
+# ld_load
+# load the program, for now, we just execute it
+#
+proc ld_load { target1 target2 } {
+ global exec_output
+
+ if ![file exists $target1] then {
+ unresolved "$target1 does not exist."
+ }
+
+ if ![file exists $target2] then {
+ unresolved "$target2 does not exist."
+ }
+
+ set status [catch "exec cmp $target1 $target2" exec_output]
+ verbose "### COMPARE $target1 $target2\n"
+ if ![string match "" $exec_output] then {
+ send_log "$exec_output\n"
+ verbose "$exec_output" 1
+ return 1
+ } else {
+ return 0
+ }
+}
+
+#
+# ld_exit -- just a stub for ld
+#
+proc ld_exit {} {
+}
+
+#
+# ld_start
+# relink the linker
+#
+proc ld_start { ld target } {
+ #
+}
+
+#
+# ld_relocate
+# link an object using relocation
+#
+proc ld_relocate { ld target objects } {
+ default_ld_relocate $ld $target $objects
+}
+
+#
+# ld_link
+# link a program using ld
+#
+proc ld_link { ld target objects } {
+ default_ld_link $ld $target $objects
+}
+
+#
+# ld_simple_link
+# link a program using ld, without including any libraries
+#
+proc ld_simple_link { ld target objects } {
+ default_ld_simple_link $ld $target $objects
+}
+
+#
+# ld_compile
+# compile an object using $cc
+#
+proc ld_compile { cc source object } {
+ default_ld_compile $cc $source $object
+}
+
+#
+# ld_assemble
+# assemble a file
+#
+proc ld_assemble { as source object } {
+ default_ld_assemble $as $source $object
+}
+
+#
+# ld_nm
+# run nm on a file
+#
+proc ld_nm { nm object } {
+ default_ld_nm $nm $object
+}
+
+#
+# ld_exec
+# execute ithe target
+#
+proc ld_exec { target output } {
+ default_ld_exec $target $output
+}
+
+++ /dev/null
-#
-# Expect script for LD Regression Tests
-# Copyright (C) 1993 Free Software Foundation
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#
-# $Id$
-#
-# Written by Jeffrey Wheat (cassidy@cygnus.com)
-#
-
-if ![info exists ld] then {
- set ld [findfile $objdir/ld.new $objdir/ld.new [transform ld]]
-}
-
-# load the utility procedures
-load_lib ld.exp
-
-#
-# ld_version -- extract and print the version number of ld compiler (GCC)
-#
-proc ld_version {} {
- global ld
- default_ld_version $ld
-}
-
-#
-# ld_load
-# load the program, for now, we just execute it
-#
-proc ld_load { target1 target2 } {
- global exec_output
-
- if ![file exists $target1] then {
- unresolved "$target1 does not exist."
- }
-
- if ![file exists $target2] then {
- unresolved "$target2 does not exist."
- }
-
- set status [catch "exec cmp $target1 $target2" exec_output]
- verbose "### COMPARE $target1 $target2\n"
- if ![string match "" $exec_output] then {
- send_log "$exec_output\n"
- verbose "$exec_output" 1
- return 1
- } else {
- return 0
- }
-}
-
-#
-# ld_exit -- just a stub for ld
-#
-proc ld_exit {} {
-}
-
-#
-# ld_start
-# relink the linker
-#
-proc ld_start { ld target } {
- #
-}
-
-#
-# ld_relocate
-# link an object using relocation
-#
-proc ld_relocate { ld target objects } {
- default_ld_relocate $ld $target $objects
-}
-
-#
-# ld_link
-# link a program using ld
-#
-proc ld_link { ld target objects } {
- default_ld_link $ld $target $objects
-}
-
-#
-# ld_compile
-# compile an object using $cc
-#
-proc ld_compile { cc source object } {
- default_ld_compile $cc $source $object
-}
-
-#
-# ld_exec
-# execute ithe target
-#
-proc ld_exec { target output } {
- default_ld_exec $target $output
-}
-
--- /dev/null
+# .Sanitize for ld dejagnu testsuites
+
+# Each directory to survive it's way into a release will need a file
+# like this one called "./.Sanitize". All keyword lines must exist,
+# and must exist in the order specified by this file. Each directory
+# in the tree will be processed, top down, in the following order..
+
+# Hash started lines like this one are comments and will be deleted
+# before anything else is done. Blank lines will also be squashed
+# out.
+
+# The lines between the "Do-first:" line and the "Things-to-keep:"
+# line are executed as a /bin/sh shell script before anything else is
+# done in this directory.
+
+Do-first:
+
+# All files listed between the "Things-to-keep:" line and the
+# "Do-last:" line will be kept. All other files will be removed.
+# Directories listed in this section will have their own Sanitize
+# called. Directories not listed will be removed in their entirety
+# with rm -rf.
+
+Things-to-keep:
+
+defined.exp
+defined.s
+defined.t
+
+Things-to-lose:
+
+# The lines between the "Do-last:" line and the end of the file
+# are executed as a /bin/sh shell script after everything else is
+# done.
+
+Do-last:
+
+#eof
--- /dev/null
+# Test DEFINED in a linker script.
+# By Ian Lance Taylor, Cygnus Support.
+
+if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status}
+
+set as [findfile $base_dir/../gas/as.new $base_dir/../gas/as.new [transform as]]
+set nm [findfile $base_dir/../binutils/nm.new $base_dir/../binutils/nm.new [transform nm]]
+
+if ![ld_assemble $as $srcdir$subdir/defined.s tmpdir/def.o] { return }
+
+set prms_id 5699
+
+if ![ld_simple_link $ld tmpdir/def "-T $srcdir$subdir/defined.t tmpdir/def.o"] {
+ fail DEFINED
+} else {
+ if [ld_nm $nm tmpdir/def] {
+ if {![info exists nm_output(value1)] \
+ || ![info exists nm_output(value2)]} {
+ perror "bad output from $nm"
+ } else {
+ if {$nm_output(value1) != 1} {
+ fail "DEFINED (value1 == $nm_output(value1))"
+ } else {
+ if {$nm_output(value2) != 2} {
+ fail "DEFINED (value2 == $nm_output(value2))"
+ } else {
+ pass DEFINED
+ }
+ }
+ }
+ }
+}
+
+set prms_id 0
--- /dev/null
+ .globl defined
+ defined = 1
--- /dev/null
+SECTIONS {
+ .text : { *(.text) }
+}
+value1 = DEFINED (defined) ? 1 : 2;
+value2 = DEFINED (undefined) ? 1 : 2;
}
}
+#
+# 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
}
}
+#
+# 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