From f81eadb499e778fc75fc0178ce226dc142f81e6b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 28 Sep 1994 16:21:32 +0000 Subject: [PATCH] * config/default.exp: Set variables as and nm. Create tmpdir if it does not already exist. * ld.bootstrap/bootstrap.exp: Don't create tmpdir here. * ld.cdtest/cdtest.exp: Likewise. * ld.scripts/defined.exp: Likewise. Also, don't set as and nm here. Change perror for no variables found to fail. * ld.scripts/script.exp: New test. * ld.scripts/script.t, ld.scripts/script.s: New files. --- ld/testsuite/ChangeLog | 11 +++++++++ ld/testsuite/ld.bootstrap/bootstrap.exp | 2 -- ld/testsuite/ld.cdtest/cdtest.exp | 2 -- ld/testsuite/ld.scripts/.Sanitize | 3 +++ ld/testsuite/ld.scripts/defined.exp | 7 +----- ld/testsuite/ld.scripts/script.exp | 31 +++++++++++++++++++++++++ ld/testsuite/ld.scripts/script.s | 6 +++++ ld/testsuite/ld.scripts/script.t | 14 +++++++++++ 8 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 ld/testsuite/ld.scripts/script.exp create mode 100644 ld/testsuite/ld.scripts/script.s create mode 100644 ld/testsuite/ld.scripts/script.t diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index f2df1ea287f..cee77f47b4a 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,14 @@ +Wed Sep 28 12:18:54 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * config/default.exp: Set variables as and nm. Create tmpdir if + it does not already exist. + * ld.bootstrap/bootstrap.exp: Don't create tmpdir here. + * ld.cdtest/cdtest.exp: Likewise. + * ld.scripts/defined.exp: Likewise. Also, don't set as and nm + here. Change perror for no variables found to fail. + * ld.scripts/script.exp: New test. + * ld.scripts/script.t, ld.scripts/script.s: New files. + Tue Sep 27 14:59:51 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) * ld.scripts: New directory. diff --git a/ld/testsuite/ld.bootstrap/bootstrap.exp b/ld/testsuite/ld.bootstrap/bootstrap.exp index 76d95b5ead5..f2e7c5cc7db 100644 --- a/ld/testsuite/ld.bootstrap/bootstrap.exp +++ b/ld/testsuite/ld.bootstrap/bootstrap.exp @@ -28,8 +28,6 @@ if ![isnative] {return} # we need the object files. if {$ld != "$objdir/ld.new"} {return} -if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} - # Bootstrap ld. First link the object files together using -r, in # order to test -r. Then link the result into an executable, ld1, to # really test -r. Use ld1 to link a fresh ld, ld2. Use ld2 to link a diff --git a/ld/testsuite/ld.cdtest/cdtest.exp b/ld/testsuite/ld.cdtest/cdtest.exp index e605c6118ff..bc390f2c476 100644 --- a/ld/testsuite/ld.cdtest/cdtest.exp +++ b/ld/testsuite/ld.cdtest/cdtest.exp @@ -24,8 +24,6 @@ # This test requires running the executable generated by ld. if ![isnative] {return} -if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} - if ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o] { return } diff --git a/ld/testsuite/ld.scripts/.Sanitize b/ld/testsuite/ld.scripts/.Sanitize index 3f2a02ef44d..b68da1b6cc3 100644 --- a/ld/testsuite/ld.scripts/.Sanitize +++ b/ld/testsuite/ld.scripts/.Sanitize @@ -26,6 +26,9 @@ Things-to-keep: defined.exp defined.s defined.t +script.exp +script.s +script.t Things-to-lose: diff --git a/ld/testsuite/ld.scripts/defined.exp b/ld/testsuite/ld.scripts/defined.exp index d551f080000..a1f86986fb3 100644 --- a/ld/testsuite/ld.scripts/defined.exp +++ b/ld/testsuite/ld.scripts/defined.exp @@ -1,11 +1,6 @@ # 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 @@ -16,7 +11,7 @@ if ![ld_simple_link $ld tmpdir/def "-T $srcdir$subdir/defined.t tmpdir/def.o"] { if [ld_nm $nm tmpdir/def] { if {![info exists nm_output(value1)] \ || ![info exists nm_output(value2)]} { - perror "bad output from $nm" + fail "DEFINED (bad output from $nm)" } else { if {$nm_output(value1) != 1} { fail "DEFINED (value1 == $nm_output(value1))" diff --git a/ld/testsuite/ld.scripts/script.exp b/ld/testsuite/ld.scripts/script.exp new file mode 100644 index 00000000000..0cbd084911f --- /dev/null +++ b/ld/testsuite/ld.scripts/script.exp @@ -0,0 +1,31 @@ +# Test basic linker script functionality +# By Ian Lance Taylor, Cygnus Support + +if ![ld_assemble $as $srcdir$subdir/script.s tmpdir/script.o] { return } + +if ![ld_simple_link $ld tmpdir/script "-T $srcdir$subdir/script.t tmpdir/script.o"] { + fail script +} else { + if [ld_nm $nm tmpdir/script] { + if {![info exists nm_output(text_start)] \ + || ![info exists nm_output(text_end)] \ + || ![info exists nm_output(data_start)] \ + || ![info exists nm_output(data_end)]} { + fail "script (bad output from $nm)" + } else { + if {$nm_output(text_start) != 0x100} { + fail "script (text_start == $nm_output(text_start))" + } else { if {$nm_output(text_end) < 0x104 \ + || $nm_output(text_end) > 0x110} { + fail "script (text_end == $nm_output(text_end))" + } else { if {$nm_output(data_start) != 0x1000} { + fail "script (data_start == $nm_output(data_start))" + } else { if {$nm_output(data_end) < 0x1004 \ + || $nm_output(data_end) > 0x1010} { + fail "script (data_end == $nm_output(data_end))" + } else { + pass script + } } } } + } + } +} diff --git a/ld/testsuite/ld.scripts/script.s b/ld/testsuite/ld.scripts/script.s new file mode 100644 index 00000000000..a8629117091 --- /dev/null +++ b/ld/testsuite/ld.scripts/script.s @@ -0,0 +1,6 @@ + .text +text_symbol: + .long 1 + .data +data_symbol: + .long 2 diff --git a/ld/testsuite/ld.scripts/script.t b/ld/testsuite/ld.scripts/script.t new file mode 100644 index 00000000000..3da47e1858f --- /dev/null +++ b/ld/testsuite/ld.scripts/script.t @@ -0,0 +1,14 @@ +SECTIONS +{ + .text 0x100 : { + text_start = .; + *(.text) + text_end = .; + } + . = 0x1000; + .data : { + data_start = .; + *(.data) + data_end = .; + } +} -- 2.30.2