f19ae42f43
* emulparams/shelf32_nbsd.sh (OTHER_SECTIONS): Redefine. [ld/testsuite] * ld-sh/rd-sh.exp (LDFLAGS): Define appropriately for each sh64/sh5 targets. * ld-sh/sh.exp: Don't do relaxing test for sh64*-*-* and sh5*-*-* targets. * ld-sh/sh64/relax.exp (emul32): Set to shelf32_nbsd for netbsd. * ld-sh/sh64/relfail.exp: Set parameters for netbsd. * ld-sh/sh64/sh64.exp: Skip this for netbsd. Trim the section numbers for crangerel1 and crengerel2 tests. * ld-sh/sh64/abi32.sd: Update. * ld-sh/sh64/abi32.xd: Likewise. * ld-sh/sh64/abi64.sd: Likewise. * ld-sh/sh64/abi64.xd: Likewise. * ld-sh/sh64/abixx-noexp.sd: Likewise. * ld-sh/sh64/cmpct1.sd: Likewise. * ld-sh/sh64/cmpct1.xd: Likewise. * ld-sh/sh64/crange1.rd: Likewise. * ld-sh/sh64/crange2.rd: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crange3.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-sh/sh64/dlsection.sd: Likewise. * ld-sh/sh64/endian.sbd: Likewise. * ld-sh/sh64/endian.sld: Likewise. * ld-sh/sh64/gotplt.d: Likewise. * ld-sh/sh64/init-cmpct.d: Likewise. * ld-sh/sh64/init-media.d: Likewise. * ld-sh/sh64/init.s: Align functions. * ld-sh/sh64/init64.d: Update. * ld-sh/sh64/mix1-noexp.sd: Likewise. * ld-sh/sh64/mix1.sd: Likewise. * ld-sh/sh64/mix1.xd: Likewise. * ld-sh/sh64/mix2-noexp.sd: Likewise. * ld-sh/sh64/mix2.sd: Likewise. * ld-sh/sh64/mix2.xd:Likewise. * ld-sh/sh64/rel32.xd: Likewise. * ld-sh/sh64/rel64.xd: Likewise. * ld-sh/sh64/reldl32.rd: Likewise. * ld-sh/sh64/reldl64.rd: Likewise. * ld-sh/sh64/shdl32.xd: Update. * ld-sh/sh64/shdl64.sd: Likewise. * ld-sh/sh64/shdl64.xd: Likewise. * ld-sh/shared-1.d: Add -z nocombreloc to ld option. Update. * ld-sh/sub2l-1.d: Make file format match with elf32-sh.*. * ld-sh/weak1.d: Likewise.
162 lines
4.5 KiB
Text
162 lines
4.5 KiB
Text
# Expect script for ld-sh tests
|
|
# Copyright 1995, 1996, 1997, 2001 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.
|
|
#
|
|
# Written by Ian Lance Taylor (ian@cygnus.com)
|
|
#
|
|
|
|
# Test SH relaxing. This tests the compiler and assembler as well as
|
|
# the linker.
|
|
|
|
if ![istarget sh*-*-*] {
|
|
return
|
|
}
|
|
|
|
if { ([istarget sh64*-*-*] || [istarget sh5*-*-*])} {
|
|
# relaxing not supported on sh64 yet.
|
|
return
|
|
}
|
|
|
|
set testsimple "SH simple relaxing"
|
|
|
|
if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] {
|
|
unresolved $testsimple
|
|
} else { if ![ld_simple_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] {
|
|
fail $testsimple
|
|
} else {
|
|
if ![ld_nm $nm "" tmpdir/sh1] {
|
|
unresolved $testsimple
|
|
} else {
|
|
if {![info exists nm_output(bar)] \
|
|
|| ![info exists nm_output(foo)]} {
|
|
send_log "bad output from nm\n"
|
|
verbose "bad output from nm"
|
|
fail $testsimple
|
|
} else {
|
|
if {$nm_output(bar) != $nm_output(foo) + 4} {
|
|
send_log "foo == $nm_output(foo)\n"
|
|
verbose "foo == $nm_output(foo)"
|
|
send_log "bar == $nm_output(bar)\n"
|
|
verbose "bar == $nm_output(bar)"
|
|
fail $testsimple
|
|
} else {
|
|
pass $testsimple
|
|
}
|
|
}
|
|
}
|
|
} }
|
|
|
|
set testsrec "SH relaxing to S-records"
|
|
|
|
if [istarget sh*-linux-gnu] {
|
|
# This target needs the explicit entry address.
|
|
catch "exec $objdump -x tmpdir/sh1 | grep start\\ address | sed s/start\\ address//" entry_addr
|
|
set srec_relax_arg "-Ttext $entry_addr -relax --oformat srec tmpdir/sh1.o"
|
|
} else {
|
|
set srec_relax_arg "-relax --oformat srec tmpdir/sh1.o"
|
|
}
|
|
if ![ld_simple_link $ld tmpdir/sh1.s1 $srec_relax_arg ] {
|
|
fail $testsrec
|
|
} else {
|
|
# The file name is embedded in the S-records, so create both
|
|
# files with the same name.
|
|
catch "exec rm -f tmpdir/sh1.s2" exec_output
|
|
send_log "mv tmpdir/sh1.s1 tmpdir/sh1.s2\n"
|
|
verbose "mv tmpdir/sh1.s1 tmpdir/sh1.s2"
|
|
catch "exec mv tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
|
|
if ![string match "" $exec_output] {
|
|
send_log "$exec_output\n"
|
|
verbose "$exec_output"
|
|
unresolved $testsrec
|
|
} else {
|
|
send_log "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
|
|
verbose "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
|
|
catch "exec $objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1" exec_output
|
|
if ![string match "" $exec_output] {
|
|
send_log "$exec_output\n"
|
|
verbose "$exec_output"
|
|
unresolved $testsrec
|
|
} else {
|
|
send_log "cmp tmpdir/sh1.s1 tmpdir/sh1.s2\n"
|
|
verbose "cmp tmpdir/sh1.s1 tmpdir/sh1.s2"
|
|
catch "exec cmp tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
|
|
set exec_output [prune_warnings $exec_output]
|
|
if ![string match "" $exec_output] {
|
|
send_log "$exec_output\n"
|
|
verbose "$exec_output"
|
|
fail $testsrec
|
|
} else {
|
|
pass $testsrec
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
set testlink "SH relaxing"
|
|
set testjsr "SH confirm relaxing"
|
|
set testrun "SH relaxing execution"
|
|
|
|
if { [which $CC] == 0 } {
|
|
untested $testlink
|
|
untested $testjsr
|
|
untested $testrun
|
|
return
|
|
}
|
|
|
|
if [istarget sh*-linux-gnu] {
|
|
exec sed -e s/_main/main/ -e s/_trap/trap/ -e s/_stack/stack/ \
|
|
< $srcdir/$subdir/start.s >tmpdir/start.s
|
|
} else {
|
|
exec cp $srcdir/$subdir/start.s tmpdir/start.s
|
|
}
|
|
|
|
if {![ld_assemble $as "-relax tmpdir/start.s" tmpdir/start.o] \
|
|
|| ![ld_compile $CC "-O -mrelax $srcdir/$subdir/sh2.c" tmpdir/sh2.o]} {
|
|
unresolved $testlink
|
|
unresolved $testjsr
|
|
unresolved $testrun
|
|
return
|
|
}
|
|
|
|
if ![ld_simple_link $ld tmpdir/sh2 "-relax tmpdir/start.o tmpdir/sh2.o"] {
|
|
fail $testlink
|
|
unresolved $testjsr
|
|
unresolved $testrun
|
|
return
|
|
}
|
|
|
|
pass $testlink
|
|
|
|
send_log "$objdump -d tmpdir/sh2\n"
|
|
verbose "$objdump -d tmpdir/sh2"
|
|
catch "exec $objdump -d tmpdir/sh2" exec_output
|
|
if [string match "*jsr*" $exec_output] {
|
|
fail $testjsr
|
|
} else {
|
|
pass $testjsr
|
|
}
|
|
|
|
if { ![info exists SIM] || [which $SIM] == 0 } {
|
|
untested $testrun
|
|
return
|
|
}
|
|
|
|
set status [catch "exec $SIM tmpdir/sh2" exec_output]
|
|
if { $status == 0 } {
|
|
pass $testrun
|
|
} else {
|
|
fail $testrun
|
|
}
|