OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.18.50/] [ld/] [testsuite/] [ld-sh/] [sh.exp] - Diff between revs 38 and 156

Only display areas with differences | Details | Blame | View Log

Rev 38 Rev 156
# Expect script for ld-sh tests
# Expect script for ld-sh tests
#   Copyright 1995, 1996, 1997, 2001, 2002, 2003, 2007
#   Copyright 1995, 1996, 1997, 2001, 2002, 2003, 2007
#   Free Software Foundation, Inc.
#   Free Software Foundation, Inc.
#
#
# This file is part of the GNU Binutils.
# This file is part of the GNU Binutils.
#
#
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
# MA 02110-1301, USA.
#
#
# Written by Ian Lance Taylor (ian@cygnus.com)
# Written by Ian Lance Taylor (ian@cygnus.com)
#
#
# Test SH relaxing.  This tests the compiler and assembler as well as
# Test SH relaxing.  This tests the compiler and assembler as well as
# the linker.
# the linker.
if ![istarget sh*-*-*] {
if ![istarget sh*-*-*] {
    return
    return
}
}
if { ([istarget sh64*-*-*] || [istarget sh5*-*-*])} {
if { ([istarget sh64*-*-*] || [istarget sh5*-*-*])} {
    # relaxing not supported on sh64 yet.
    # relaxing not supported on sh64 yet.
    return
    return
}
}
set testsimple "SH simple relaxing"
set testsimple "SH simple relaxing"
if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] {
if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] {
    unresolved $testsimple
    unresolved $testsimple
} else { if ![ld_simple_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] {
} else { if ![ld_simple_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] {
    fail $testsimple
    fail $testsimple
} else {
} else {
    if ![ld_nm $nm "" tmpdir/sh1] {
    if ![ld_nm $nm "" tmpdir/sh1] {
        unresolved $testsimple
        unresolved $testsimple
    } else {
    } else {
        if {![info exists nm_output(bar)] \
        if {![info exists nm_output(bar)] \
             || ![info exists nm_output(foo)]} {
             || ![info exists nm_output(foo)]} {
            send_log "bad output from nm\n"
            send_log "bad output from nm\n"
            verbose "bad output from nm"
            verbose "bad output from nm"
            fail $testsimple
            fail $testsimple
        } else {
        } else {
            if {$nm_output(bar) != $nm_output(foo) + 4} {
            if {$nm_output(bar) != $nm_output(foo) + 4} {
                send_log "foo == $nm_output(foo)\n"
                send_log "foo == $nm_output(foo)\n"
                verbose "foo == $nm_output(foo)"
                verbose "foo == $nm_output(foo)"
                send_log "bar == $nm_output(bar)\n"
                send_log "bar == $nm_output(bar)\n"
                verbose "bar == $nm_output(bar)"
                verbose "bar == $nm_output(bar)"
                fail $testsimple
                fail $testsimple
            } else {
            } else {
                pass $testsimple
                pass $testsimple
            }
            }
        }
        }
    }
    }
} }
} }
set testsrec "SH relaxing to S-records"
set testsrec "SH relaxing to S-records"
if { [istarget sh*-linux-*] || [istarget sh-*-vxworks] } {
if { [istarget sh*-linux-*] || [istarget sh-*-vxworks] } {
    # On these "non-embedded" targets, the default ELF and srec start
    # On these "non-embedded" targets, the default ELF and srec start
    # addresses will be SIZEOF_HEADERS bytes apart.  Ensure consistency
    # addresses will be SIZEOF_HEADERS bytes apart.  Ensure consistency
    # by feeding the ELF start address to the srec link line.
    # by feeding the ELF start address to the srec link line.
    catch "exec $objdump -x tmpdir/sh1 | grep start\\ address | sed s/start\\ address//" entry_addr
    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"
    set srec_relax_arg "-Ttext $entry_addr -relax --oformat srec tmpdir/sh1.o"
} else {
} else {
    set srec_relax_arg "-relax --oformat srec tmpdir/sh1.o"
    set srec_relax_arg "-relax --oformat srec tmpdir/sh1.o"
}
}
if ![ld_simple_link $ld tmpdir/sh1.s1 $srec_relax_arg ] {
if ![ld_simple_link $ld tmpdir/sh1.s1 $srec_relax_arg ] {
    fail $testsrec
    fail $testsrec
} else {
} else {
    # The file name is embedded in the S-records, so create both
    # The file name is embedded in the S-records, so create both
    # files with the same name.
    # files with the same name.
    catch "exec rm -f tmpdir/sh1.s2" exec_output
    catch "exec rm -f tmpdir/sh1.s2" exec_output
    send_log "mv tmpdir/sh1.s1 tmpdir/sh1.s2\n"
    send_log "mv tmpdir/sh1.s1 tmpdir/sh1.s2\n"
    verbose "mv tmpdir/sh1.s1 tmpdir/sh1.s2"
    verbose "mv tmpdir/sh1.s1 tmpdir/sh1.s2"
    catch "exec mv tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
    catch "exec mv tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
    if ![string match "" $exec_output] {
    if ![string match "" $exec_output] {
        send_log "$exec_output\n"
        send_log "$exec_output\n"
        verbose "$exec_output"
        verbose "$exec_output"
        unresolved $testsrec
        unresolved $testsrec
    } else {
    } else {
        send_log "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
        send_log "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
        verbose "$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
        catch "exec $objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1" exec_output
        if ![string match "" $exec_output] {
        if ![string match "" $exec_output] {
            send_log "$exec_output\n"
            send_log "$exec_output\n"
            verbose "$exec_output"
            verbose "$exec_output"
            unresolved $testsrec
            unresolved $testsrec
        } else {
        } else {
            send_log "cmp tmpdir/sh1.s1 tmpdir/sh1.s2\n"
            send_log "cmp tmpdir/sh1.s1 tmpdir/sh1.s2\n"
            verbose "cmp tmpdir/sh1.s1 tmpdir/sh1.s2"
            verbose "cmp tmpdir/sh1.s1 tmpdir/sh1.s2"
            catch "exec cmp tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
            catch "exec cmp tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
            set exec_output [prune_warnings $exec_output]
            set exec_output [prune_warnings $exec_output]
            if ![string match "" $exec_output] {
            if ![string match "" $exec_output] {
                send_log "$exec_output\n"
                send_log "$exec_output\n"
                verbose "$exec_output"
                verbose "$exec_output"
                fail $testsrec
                fail $testsrec
            } else {
            } else {
                pass $testsrec
                pass $testsrec
            }
            }
        }
        }
    }
    }
}
}
set testlink "SH relaxing"
set testlink "SH relaxing"
set testjsr "SH confirm relaxing"
set testjsr "SH confirm relaxing"
set testrun "SH relaxing execution"
set testrun "SH relaxing execution"
if { [which $CC] == 0 } {
if { [which $CC] == 0 } {
    untested $testlink
    untested $testlink
    untested $testjsr
    untested $testjsr
    untested $testrun
    untested $testrun
    return
    return
}
}
if [istarget sh*-linux-*] {
if [istarget sh*-linux-*] {
    exec sed -e s/_main/main/ -e s/_trap/trap/ -e s/_stack/stack/ \
    exec sed -e s/_main/main/ -e s/_trap/trap/ -e s/_stack/stack/ \
            < $srcdir/$subdir/start.s >tmpdir/start.s
            < $srcdir/$subdir/start.s >tmpdir/start.s
} else {
} else {
    exec cp $srcdir/$subdir/start.s tmpdir/start.s
    exec cp $srcdir/$subdir/start.s tmpdir/start.s
}
}
if {![ld_assemble $as "-relax tmpdir/start.s" tmpdir/start.o] \
if {![ld_assemble $as "-relax tmpdir/start.s" tmpdir/start.o] \
    || ![ld_compile $CC "-O -mrelax $srcdir/$subdir/sh2.c" tmpdir/sh2.o]} {
    || ![ld_compile $CC "-O -mrelax $srcdir/$subdir/sh2.c" tmpdir/sh2.o]} {
    unresolved $testlink
    unresolved $testlink
    unresolved $testjsr
    unresolved $testjsr
    unresolved $testrun
    unresolved $testrun
    return
    return
}
}
if ![ld_simple_link $ld tmpdir/sh2 "-relax tmpdir/start.o tmpdir/sh2.o"] {
if ![ld_simple_link $ld tmpdir/sh2 "-relax tmpdir/start.o tmpdir/sh2.o"] {
    fail $testlink
    fail $testlink
    unresolved $testjsr
    unresolved $testjsr
    unresolved $testrun
    unresolved $testrun
    return
    return
}
}
pass $testlink
pass $testlink
send_log "$objdump -d tmpdir/sh2\n"
send_log "$objdump -d tmpdir/sh2\n"
verbose "$objdump -d tmpdir/sh2"
verbose "$objdump -d tmpdir/sh2"
catch "exec $objdump -d tmpdir/sh2" exec_output
catch "exec $objdump -d tmpdir/sh2" exec_output
if [string match "*jsr*" $exec_output] {
if [string match "*jsr*" $exec_output] {
    fail $testjsr
    fail $testjsr
} else {
} else {
    pass $testjsr
    pass $testjsr
}
}
if { ![info exists SIM] || [which $SIM] == 0 } {
if { ![info exists SIM] || [which $SIM] == 0 } {
    untested $testrun
    untested $testrun
    return
    return
}
}
set status [catch "exec $SIM tmpdir/sh2" exec_output]
set status [catch "exec $SIM tmpdir/sh2" exec_output]
if { $status == 0 } {
if { $status == 0 } {
    pass $testrun
    pass $testrun
} else {
} else {
    fail $testrun
    fail $testrun
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.