aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog41
-rw-r--r--ld/testsuite/ld-sh/sh64/sh64.exp28
-rw-r--r--ld/testsuite/lib/ld-lib.exp121
3 files changed, 112 insertions, 78 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index f76f116..3695178 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,7 +1,14 @@
+2002-07-03 Alan Modra <amodra@bigpond.net.au>
+
+ * lib/ld-lib.exp (default_ld_nm): Run nm with LC_ALL=C to ensure
+ consistent sorting.
+ (run_dump_test): Likewise for objdump/nm/objcopy/readelf.
+ * ld-sh/sh64/sh64.exp (run_ld_link_tests): Likewise.
+
2002-06-29 Hans-Peter Nilsson <hp@bitrange.com>
* ld-mmix/sec-8m.d, ld-mmix/sec-8m.s, ld-mmix/sec-8a.s,
- ld-mmix/sec-8b.s, ld-mmix/sec-8d.s: New test.
+ ld-mmix/sec-8b.s, ld-mmix/sec-8d.s: New test.
2002-06-18 Chris Demetriou <cgd@broadcom.com>
@@ -14,7 +21,7 @@
* ld-d10v/default_layout.d : New test.
* ld-d10v/regression-001.lt: New test for a linker regression.
* ld-d10v/linktest-002.lt: New test for run_link_test.
- * ld-d10v/reloc-001.d - reloc-016.d: New tests.
+ * ld-d10v/reloc-001.d - reloc-016.d: New tests.
2002-06-11 John David Anglin <dave@hiauly1.hia.nrc.ca>
@@ -36,9 +43,9 @@
2002-06-07 Nick Clifton <nickc@cambridge.redhat.com>
* ld-scripts/phdrs2.s: Use .p2align instead of .align.
- Use section names .foo and .bar instead of .text and .data.
- * ld-scripts/phdrs2.t: Refer to .foo and .bar instead of .text
- and .data.
+ Use section names .foo and .bar instead of .text and .data.
+ * ld-scripts/phdrs2.t: Refer to .foo and .bar instead of .text
+ and .data.
2002-06-06 David Heine <dlheine@tensilica.com>
@@ -206,11 +213,11 @@
2001-03-14 DJ Delorie <dj@redhat.com>
* ld-sh/sh64/endian.dbd: New file, endian tests.
* ld-sh/sh64/endian.dld: Ditto.
- * ld-sh/sh64/endian.ld: Ditto.
- * ld-sh/sh64/endian.s: Ditto.
- * ld-sh/sh64/endian.sbd: Ditto.
- * ld-sh/sh64/endian.sld: Ditto.
- * ld-sh/sh64/sh64.exp: Add above tests. Add -L option to ld.
+ * ld-sh/sh64/endian.ld: Ditto.
+ * ld-sh/sh64/endian.s: Ditto.
+ * ld-sh/sh64/endian.sbd: Ditto.
+ * ld-sh/sh64/endian.sld: Ditto.
+ * ld-sh/sh64/sh64.exp: Add above tests. Add -L option to ld.
2001-03-12 DJ Delorie <dj@redhat.com>
* ld-sh/sh64/relax.exp: New file, test disabling relaxing.
* ld-sh/sh64/relax1.s: Ditto.
@@ -1131,9 +1138,9 @@ Wed Jun 9 12:02:33 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
Tue Feb 2 19:15:02 1999 Catherine Moore <clm@cygnus.com>
- * ld-selective/selective.exp: Disable test for unsupported
- targets. Change tests to check for absence of symbols instead
- of address zero.
+ * ld-selective/selective.exp: Disable test for unsupported
+ targets. Change tests to check for absence of symbols instead
+ of address zero.
Mon Jan 18 03:44:52 1999 Ian Lance Taylor <ian@cygnus.com>
@@ -1173,10 +1180,10 @@ Sun Dec 6 12:59:37 1998 H.J. Lu <hjl@gnu.org>
Fri Oct 23 16:28:29 1998 Catherine Moore <clm@cygnus.com>
- * ld-selective: New directory with new files to test
- selective linking.
+ * ld-selective: New directory with new files to test
+ selective linking.
- * lib/ld-lib.exp (ld_nm): Strip leading underscore from $name.
+ * lib/ld-lib.exp (ld_nm): Strip leading underscore from $name.
Sun Oct 4 22:17:05 1998 Ian Lance Taylor <ian@cygnus.com>
@@ -1793,7 +1800,7 @@ Fri May 27 09:35:04 1994 Ken Raeburn (raeburn@cygnus.com)
Tue May 17 15:06:49 1994 Bill Cox (bill@rtl.cygnus.com)
* ld.bootstrap/bootstrap.exp, lib/ld.exp: Replace error proc
- calls with perror calls.
+ calls with perror calls.
Wed May 11 16:47:46 1994 Ken Raeburn (raeburn@rtl.cygnus.com)
diff --git a/ld/testsuite/ld-sh/sh64/sh64.exp b/ld/testsuite/ld-sh/sh64/sh64.exp
index d412a2c..555436e 100644
--- a/ld/testsuite/ld-sh/sh64/sh64.exp
+++ b/ld/testsuite/ld-sh/sh64/sh64.exp
@@ -5,12 +5,12 @@
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -119,7 +119,7 @@ set sh64tests {
{"SH64 Little Endianness" "-mshlelf64 -Tendian.ld"
"--abi=64 --little" {endian.s}
{{objdump -s endian.sld} {objdump -d endian.dld}}}
-
+
}
# FIXME: Generalize and move this to ld-lib.exp
@@ -132,6 +132,7 @@ proc run_ld_link_tests { ldtests } {
global readelf
global srcdir
global subdir
+ global env
set binfile "tmpdir/linked"
@@ -199,8 +200,19 @@ proc run_ld_link_tests { ldtests } {
set dumpfile [lindex $actionlist 2]
set binary $dump_prog
- send_log "$binary $progopts $binfile > dump.out\n"
- catch "exec $binary $progopts $binfile > dump.out" comp_output
+ # Ensure consistent sorting of symbols
+ if {[info exists env(LC_ALL)]} {
+ set old_lc_all $env(LC_ALL)
+ }
+ set env(LC_ALL) "C"
+ set cmd "$binary $progopts $binfile > dump.out"
+ send_log "$cmd\n"
+ catch "exec $cmd" comp_output
+ if {[info exists old_lc_all]} {
+ set env(LC_ALL) $old_lc_all
+ } else {
+ unset env(LC_ALL)
+ }
set comp_output [prune_warnings $comp_output]
if ![string match "" $comp_output] then {
@@ -300,9 +312,9 @@ proc regexp_diff { file_1 file_2 } {
}
}
- if { $diff_pass } {
- break
- } elseif { $end_1 && $end_2 } {
+ if { $diff_pass } {
+ break
+ } elseif { $end_1 && $end_2 } {
break
} elseif { $end_1 } {
send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n"
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 418c000..356819f 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1,23 +1,23 @@
# Support routines for LD testsuite.
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
-# default_ld_version
+# default_ld_version
# extract and print the version number of ld
#
proc default_ld_version { ld } {
@@ -27,7 +27,7 @@ proc default_ld_version { ld } {
perror "$ld does not exist"
exit 1
}
-
+
catch "exec $ld --version" tmp
set tmp [prune_warnings $tmp]
regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number
@@ -37,20 +37,20 @@ proc default_ld_version { ld } {
}
#
-# default_ld_relocate
+# default_ld_relocate
# link an object using relocation
#
proc default_ld_relocate { ld target objects } {
global HOSTING_EMU
global host_triplet
-
+
if { [which $ld] == 0 } then {
perror "$ld does not exist"
return 0
}
-
+
verbose -log "$ld $HOSTING_EMU -o $target -r $objects"
-
+
catch "exec $ld $HOSTING_EMU -o $target -r $objects" exec_output
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
@@ -88,7 +88,7 @@ proc is_endian_output_format { object_flags } {
# process_multilib_options.
proc big_or_little_endian {} {
-
+
if [board_info [target_info name] exists multilib_flags] {
set tmp_flags " [board_info [target_info name] multilib_flags]";
@@ -111,7 +111,7 @@ proc big_or_little_endian {} {
}
#
-# default_ld_link
+# default_ld_link
# link a program using ld
#
proc default_ld_link { ld target objects } {
@@ -121,10 +121,10 @@ proc default_ld_link { ld target objects } {
global LIBS
global host_triplet
global link_output
-
+
set objs "$HOSTING_CRT0 $objects"
set libs "$LIBS $HOSTING_LIBS"
-
+
if { [which $ld] == 0 } then {
perror "$ld does not exist"
return 0
@@ -136,7 +136,7 @@ proc default_ld_link { ld target objects } {
set flags ""
}
verbose -log "$ld $HOSTING_EMU $flags -o $target $objs $libs"
-
+
catch "exec $ld $HOSTING_EMU $flags -o $target $objs $libs" link_output
set exec_output [prune_warnings $link_output]
if [string match "" $link_output] then {
@@ -148,7 +148,7 @@ proc default_ld_link { ld target objects } {
}
#
-# default_ld_simple_link
+# default_ld_simple_link
# link a program using ld, without including any libraries
#
proc default_ld_simple_link { ld target objects } {
@@ -159,15 +159,15 @@ proc default_ld_simple_link { ld target objects } {
perror "$ld does not exist"
return 0
}
-
+
if [is_endian_output_format $objects] then {
set flags [big_or_little_endian]
} else {
set flags ""
}
-
+
verbose -log "$ld $flags -o $target $objects"
-
+
catch "exec $ld $flags -o $target $objects" link_output
set exec_output [prune_warnings $link_output]
@@ -184,7 +184,7 @@ proc default_ld_simple_link { ld target objects } {
}
#
-# default_ld_compile
+# default_ld_compile
# compile an object using cc
#
proc default_ld_compile { cc source object } {
@@ -256,7 +256,7 @@ proc default_ld_compile { cc source object } {
proc default_ld_assemble { as source object } {
global ASFLAGS
global host_triplet
-
+
if {[which $as] == 0} then {
perror "$as does not exist"
return 0
@@ -299,9 +299,19 @@ proc default_ld_nm { nm nmflags object } {
if ![info exists NMFLAGS] { set NMFLAGS "" }
+ # Ensure consistent sorting of symbols
+ if {[info exists env(LC_ALL)]} {
+ set old_lc_all $env(LC_ALL)
+ }
+ set env(LC_ALL) "C"
verbose -log "$nm $NMFLAGS $nmflags $object >tmpdir/nm.out"
catch "exec $nm $NMFLAGS $nmflags $object >tmpdir/nm.out" exec_output
+ if {[info exists old_lc_all]} {
+ set env(LC_ALL) $old_lc_all
+ } else {
+ unset env(LC_ALL)
+ }
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
set file [open tmpdir/nm.out r]
@@ -353,26 +363,26 @@ proc is_elf_format {} {
#
proc simple_diff { file_1 file_2 } {
global target
-
+
set eof -1
set differences 0
-
+
if [file exists $file_1] then {
set file_a [open $file_1 r]
} else {
warning "$file_1 doesn't exist"
return
}
-
+
if [file exists $file_2] then {
set file_b [open $file_2 r]
} else {
fail "$file_2 doesn't exist"
return
}
-
+
verbose "# Diff'ing: $file_1 $file_2\n" 2
-
+
while { [gets $file_a line] != $eof } {
if [regexp "^#.*$" $line] then {
continue
@@ -381,7 +391,7 @@ proc simple_diff { file_1 file_2 } {
}
}
close $file_a
-
+
while { [gets $file_b line] != $eof } {
if [regexp "^#.*$" $line] then {
continue
@@ -405,7 +415,7 @@ proc simple_diff { file_1 file_2 } {
return
}
}
-
+
if { [llength $list_a] != [llength $list_b] } {
fail "Test: $target"
return
@@ -416,11 +426,11 @@ proc simple_diff { file_1 file_2 } {
}
}
-# run_dump_test FILE
+# run_dump_test FILE
# Copied from gas testsuite, tweaked and further extended.
#
# Assemble a .s file, then run some utility on it and check the output.
-#
+#
# There should be an assembly language file named FILE.s in the test
# suite directory, and a pattern file called FILE.d. `run_dump_test'
# will assemble FILE.s, run some tool like `objdump', `objcopy', or
@@ -432,9 +442,9 @@ proc simple_diff { file_1 file_2 } {
# flags to pass to the assembler, the program to run to dump the
# assembler's output, and the options it wants. The option lines have
# the syntax:
-#
+#
# # OPTION: VALUE
-#
+#
# OPTION is the name of some option, like "name" or "objdump", and
# VALUE is OPTION's value. The valid options are described below.
# Whitespace is ignored everywhere, except within VALUE. The option
@@ -442,12 +452,12 @@ proc simple_diff { file_1 file_2 } {
# (hmm, not great for error detection).
#
# The interesting options are:
-#
+#
# name: TEST-NAME
# The name of this test, passed to DejaGNU's `pass' and `fail'
# commands. If omitted, this defaults to FILE, the root of the
# .s and .d files' names.
-#
+#
# as: FLAGS
# When assembling, pass FLAGS to the assembler.
# If assembling several files, you can pass different assembler
@@ -474,6 +484,8 @@ proc simple_diff { file_1 file_2 } {
# objcopy: FLAGS
# Use the specified program to analyze the assembler or linker
# output file, and pass it FLAGS, in addition to the output name.
+# Note that they are run with LC_ALL=C in the environment to give
+# consistent sorting of symbols.
#
# source: SOURCE [FLAGS]
# Assemble the file SOURCE.s using the flags in the "as" directive
@@ -512,6 +524,7 @@ proc run_dump_test { name } {
global OBJDUMP NM AS OBJCOPY READELF LD
global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS LDFLAGS
global host_triplet runtests
+ global env
if [string match "*/*" $name] {
set file $name
@@ -778,26 +791,28 @@ proc run_dump_test { name } {
# Objcopy, unlike the other two, won't send its output to stdout,
# so we have to run it specially.
+ set cmd "$binary $progopts $progopts1 $objfile > $dumpfile"
if { $program == "objcopy" } {
set cmd "$binary $progopts $progopts1 $objfile $dumpfile"
- send_log "$cmd\n"
- catch "exec $cmd" comp_output
- set comp_output [prune_warnings $comp_output]
- if ![string match "" $comp_output] then {
- send_log "$comp_output\n"
- fail $testname
- return
- }
+ }
+
+ # Ensure consistent sorting of symbols
+ if {[info exists env(LC_ALL)]} {
+ set old_lc_all $env(LC_ALL)
+ }
+ set env(LC_ALL) "C"
+ send_log "$cmd\n"
+ catch "exec $cmd" comp_output
+ if {[info exists old_lc_all]} {
+ set env(LC_ALL) $old_lc_all
} else {
- set cmd "$binary $progopts $progopts1 $objfile > $dumpfile"
- send_log "$cmd\n"
- catch "exec $cmd" comp_output
- set comp_output [prune_warnings $comp_output]
- if ![string match "" $comp_output] then {
- send_log "$comp_output\n"
- fail $testname
- return
- }
+ unset env(LC_ALL)
+ }
+ set comp_output [prune_warnings $comp_output]
+ if ![string match "" $comp_output] then {
+ send_log "$comp_output\n"
+ fail $testname
+ return
}
verbose_eval {[file_contents $dumpfile]} 3
@@ -903,9 +918,9 @@ proc regexp_diff { file_1 file_2 } {
}
}
- if { $diff_pass } {
- break
- } elseif { $end_1 && $end_2 } {
+ if { $diff_pass } {
+ break
+ } elseif { $end_1 && $end_2 } {
break
} elseif { $end_1 } {
send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n"