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/] [sh64/] [relax.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 (C) 2001, 2002, 2003, 2004, 2007 Free Software Foundation
#   Copyright (C) 2001, 2002, 2003, 2004, 2007 Free Software Foundation
#
#
# 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.
#
#
# Test SH relaxing - that is, that it's disabled when SHmedia sections
# Test SH relaxing - that is, that it's disabled when SHmedia sections
# are present.
# are present.
if ![istarget sh64-*-*] {
if ![istarget sh64-*-*] {
    return
    return
}
}
# There are four source files: the first is SHcompact only, the second
# There are four source files: the first is SHcompact only, the second
# is SHmedia only, the third has both, and the fourth has only a
# is SHmedia only, the third has both, and the fourth has only a
# .cranges section.  The table below has:
# .cranges section.  The table below has:
#   Title
#   Title
#   as flags for first source (else "n/a" to skip)
#   as flags for first source (else "n/a" to skip)
#   ditto, other three files
#   ditto, other three files
#   ld flags
#   ld flags
#   1/0 whether relaxing should have been done or not, or -1 if we expect
#   1/0 whether relaxing should have been done or not, or -1 if we expect
#     the linker to not produce an output file.
#     the linker to not produce an output file.
if [istarget sh64*-*-linux*] {
if [istarget sh64*-*-linux*] {
    set emul32 "shlelf32_linux"
    set emul32 "shlelf32_linux"
} elseif { [istarget sh64*-*-netbsd*] || [istarget sh5*-*-netbsd*] } {
} elseif { [istarget sh64*-*-netbsd*] || [istarget sh5*-*-netbsd*] } {
    set emul32 "shelf32_nbsd"
    set emul32 "shelf32_nbsd"
} else {
} else {
    set emul32 "shelf32"
    set emul32 "shelf32"
}
}
set sh64relaxtests {
set sh64relaxtests {
    {"SH64 not relaxing, shcompact"
    {"SH64 not relaxing, shcompact"
      {"-relax -isa shcompact" "n/a" "n/a" "n/a"} "-m$emul32" 0}
      {"-relax -isa shcompact" "n/a" "n/a" "n/a"} "-m$emul32" 0}
    {"SH64 relaxing, shcompact"
    {"SH64 relaxing, shcompact"
      {"-relax -isa shcompact" "n/a" "n/a" "n/a"} "-relax -m$emul32" 1}
      {"-relax -isa shcompact" "n/a" "n/a" "n/a"} "-relax -m$emul32" 1}
    {"SH64 relaxing, shcompacts"
    {"SH64 relaxing, shcompacts"
      {"-relax -isa shcompact" "-isa shcompact" "n/a" "n/a"} "-relax -m$emul32" 1}
      {"-relax -isa shcompact" "-isa shcompact" "n/a" "n/a"} "-relax -m$emul32" 1}
    {"SH64 relaxing disabled, shmedia"
    {"SH64 relaxing disabled, shmedia"
      {"-relax -isa shcompact" "-isa shmedia -no-mix" "n/a" "n/a"} "-relax -m$emul32" 0}
      {"-relax -isa shcompact" "-isa shmedia -no-mix" "n/a" "n/a"} "-relax -m$emul32" 0}
    {"SH64 relaxing disabled, mixed"
    {"SH64 relaxing disabled, mixed"
      {"-relax -isa shcompact" "n/a" "-isa shcompact" "n/a"} "-relax -m$emul32" 0}
      {"-relax -isa shcompact" "n/a" "-isa shcompact" "n/a"} "-relax -m$emul32" 0}
    {"SH64 relaxing disabled, cranges"
    {"SH64 relaxing disabled, cranges"
      {"-relax -isa shcompact" "n/a" "n/a" ""} "-relax -m$emul32" 0}
      {"-relax -isa shcompact" "n/a" "n/a" ""} "-relax -m$emul32" 0}
}
}
proc run_sh64relaxtest {sh64relaxtests} {
proc run_sh64relaxtest {sh64relaxtests} {
    global ld
    global ld
    global as
    global as
    global nm
    global nm
    global objdump
    global objdump
    global readelf
    global readelf
    global srcdir
    global srcdir
    global subdir
    global subdir
    global emul32
    global emul32
    set testindex 0
    set testindex 0
    set sh64relaxfiles {
    set sh64relaxfiles {
        "relax1.s" "relax2.s" "relax3.s" "relax4.s"
        "relax1.s" "relax2.s" "relax3.s" "relax4.s"
    }
    }
    foreach testentry $sh64relaxtests {
    foreach testentry $sh64relaxtests {
        set testname [lindex $testentry 0]
        set testname [lindex $testentry 0]
        set as_options [lindex $testentry 1]
        set as_options [lindex $testentry 1]
        set ld_options [subst [lindex $testentry 2]]
        set ld_options [subst [lindex $testentry 2]]
        set expect_relaxed [lindex $testentry 3]
        set expect_relaxed [lindex $testentry 3]
        set is_unresolved 0
        set is_unresolved 0
        set objfiles {}
        set objfiles {}
        incr testindex
        incr testindex
        # Assemble each file in the test.
        # Assemble each file in the test.
        for {set i 0} {$i < 4} {incr i} {
        for {set i 0} {$i < 4} {incr i} {
            set as_file [lindex $sh64relaxfiles $i]
            set as_file [lindex $sh64relaxfiles $i]
            set as_opt [lindex $as_options $i]
            set as_opt [lindex $as_options $i]
            if { [string compare $as_opt "n/a"] != 0 } {
            if { [string compare $as_opt "n/a"] != 0 } {
                set objfile "tmpdir/[file rootname $as_file]-$testindex.o"
                set objfile "tmpdir/[file rootname $as_file]-$testindex.o"
                lappend objfiles $objfile
                lappend objfiles $objfile
                if ![ld_assemble $as "$as_opt $srcdir/$subdir/$as_file" $objfile] {
                if ![ld_assemble $as "$as_opt $srcdir/$subdir/$as_file" $objfile] {
                    set is_unresolved 1
                    set is_unresolved 1
                    break
                    break
                }
                }
            }
            }
        }
        }
        # Catch assembler errors.
        # Catch assembler errors.
        if { $is_unresolved != 0 } {
        if { $is_unresolved != 0 } {
            unresolved $testname
            unresolved $testname
            continue
            continue
        }
        }
        set binfile "tmpdir/relax-$testindex.x"
        set binfile "tmpdir/relax-$testindex.x"
        # We're not interested in the pass/fail of the linker as much
        # We're not interested in the pass/fail of the linker as much
        # as we're interested in whether or not relaxing got properly
        # as we're interested in whether or not relaxing got properly
        # disabled.  Hence the lax checking here.
        # disabled.  Hence the lax checking here.
        file delete $binfile
        file delete $binfile
        set result [ld_simple_link $ld $binfile " --no-warn-mismatch $ld_options $objfiles"]
        set result [ld_simple_link $ld $binfile " --no-warn-mismatch $ld_options $objfiles"]
        if ![file exists $binfile] {
        if ![file exists $binfile] {
            if {$expect_relaxed == -1} {
            if {$expect_relaxed == -1} {
                pass $testname
                pass $testname
                continue
                continue
            }
            }
            verbose "$testname: file $binfile doesn't exist" 1
            verbose "$testname: file $binfile doesn't exist" 1
            fail $testname
            fail $testname
            continue
            continue
        }
        }
        catch "exec $objdump -d $binfile" objdump_output
        catch "exec $objdump -d $binfile" objdump_output
        regexp "\[ \t](jsr|bsr)\[ \t]" $objdump_output ignore calltype
        regexp "\[ \t](jsr|bsr)\[ \t]" $objdump_output ignore calltype
        if [string match $calltype "bsr"] {
        if [string match $calltype "bsr"] {
            set relaxed 1
            set relaxed 1
        } elseif [string match $calltype "jsr"] {
        } elseif [string match $calltype "jsr"] {
            set relaxed 0
            set relaxed 0
        } else {
        } else {
            verbose "$testname: neither jsr nor bsr found" 1
            verbose "$testname: neither jsr nor bsr found" 1
            verbose $objdump_output 2
            verbose $objdump_output 2
            fail $testname
            fail $testname
            continue
            continue
        }
        }
        if {$relaxed != $expect_relaxed} {
        if {$relaxed != $expect_relaxed} {
            verbose $objdump_output 2
            verbose $objdump_output 2
            fail $testname
            fail $testname
            exit
            exit
        } else {
        } else {
            pass $testname
            pass $testname
        }
        }
    }
    }
}
}
run_sh64relaxtest $sh64relaxtests
run_sh64relaxtest $sh64relaxtests
 
 

powered by: WebSVN 2.1.0

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