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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [special/] [mips-abi.exp] - Diff between revs 816 and 826

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

Rev 816 Rev 826
#   Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
#   Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
# 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 GCC; see the file COPYING3.  If not see
# along with GCC; see the file COPYING3.  If not see
# .
# .
# This test checks whether MIPS ELF configurations pass the right
# This test checks whether MIPS ELF configurations pass the right
# ABI flags to the assembler.  An ABI flag should always be passed
# ABI flags to the assembler.  An ABI flag should always be passed
# unless MEABI is selected.
# unless MEABI is selected.
load_lib gcc-dg.exp
load_lib gcc-dg.exp
# Only run this test on MIPS ELF targets
# Only run this test on MIPS ELF targets
if {![istarget mips*-*-*] || [gcc_target_object_format] != "elf"} {
if {![istarget mips*-*-*] || [gcc_target_object_format] != "elf"} {
    return
    return
}
}
# A list of all assembler ABI flags.
# A list of all assembler ABI flags.
set asm_abi_flags {-mabi=32 -mabi=n32 -mabi=64 -mabi=o64 -mabi=eabi}
set asm_abi_flags {-mabi=32 -mabi=n32 -mabi=64 -mabi=o64 -mabi=eabi}
# Try to assemble mips-abi.s (an empty file), passing -v in order to
# Try to assemble mips-abi.s (an empty file), passing -v in order to
# get the assembler command line.  Check whether an appropriate ABI
# get the assembler command line.  Check whether an appropriate ABI
# flag is passed.
# flag is passed.
#
#
# NAME is a name for the pass/fail line.
# NAME is a name for the pass/fail line.
# ABIS is a list of acceptable assembler ABI flags, or "" if no
# ABIS is a list of acceptable assembler ABI flags, or "" if no
#   ABI flag is expected.
#   ABI flag is expected.
# FLAGS is a list of options for gcc.
# FLAGS is a list of options for gcc.
proc check_mips_abi {name abis flags} {
proc check_mips_abi {name abis flags} {
    global srcdir subdir
    global srcdir subdir
    lappend flags "-v"
    lappend flags "-v"
    set lines [gcc_target_compile "$srcdir/$subdir/mips-abi.s" \
    set lines [gcc_target_compile "$srcdir/$subdir/mips-abi.s" \
                                  "mips-abi.o" object \
                                  "mips-abi.o" object \
                                  [list "additional_flags=$flags"]]
                                  [list "additional_flags=$flags"]]
    set good 0
    set good 0
    set bad 0
    set bad 0
    foreach line [split $lines "\n"] {
    foreach line [split $lines "\n"] {
        # Find the assembler command line.
        # Find the assembler command line.
        if {[string first "$srcdir/$subdir/mips-abi.s" $line] >= 0} {
        if {[string first "$srcdir/$subdir/mips-abi.s" $line] >= 0} {
            foreach arg [split $line " "] {
            foreach arg [split $line " "] {
                # Count the number of matching and non-matching
                # Count the number of matching and non-matching
                # ABI options.
                # ABI options.
                if {[lsearch -exact $abis $arg] >= 0} {
                if {[lsearch -exact $abis $arg] >= 0} {
                    incr good
                    incr good
                } elseif {[string match "-mabi=*" $arg]} {
                } elseif {[string match "-mabi=*" $arg]} {
                    incr bad
                    incr bad
                }
                }
            }
            }
        }
        }
    }
    }
    if {$good == ($abis != "") && $bad == 0} {
    if {$good == ($abis != "") && $bad == 0} {
        pass "mips-abi $name"
        pass "mips-abi $name"
    } else {
    } else {
        fail "mips-abi $name"
        fail "mips-abi $name"
    }
    }
}
}
# Collect the default target flags.
# Collect the default target flags.
set default_flags ""
set default_flags ""
set target [target_info name]
set target [target_info name]
if {[info exists CFLAGS_FOR_TARGET]} {
if {[info exists CFLAGS_FOR_TARGET]} {
    append default_flags " $CFLAGS_FOR_TARGET"
    append default_flags " $CFLAGS_FOR_TARGET"
}
}
if {[board_info $target exists cflags]} {
if {[board_info $target exists cflags]} {
    append default_flags " [board_info $target cflags]"
    append default_flags " [board_info $target cflags]"
}
}
if {[board_info $target exists multilib_flags]} {
if {[board_info $target exists multilib_flags]} {
    append default_flags " [board_info $target multilib_flags]"
    append default_flags " [board_info $target multilib_flags]"
}
}
# See whether the default command line specifies an ABI.
# See whether the default command line specifies an ABI.
set default_abi ""
set default_abi ""
foreach flag $default_flags {
foreach flag $default_flags {
    if {[string match "-mabi=*" $flag]} {
    if {[string match "-mabi=*" $flag]} {
        set default_abi $flag
        set default_abi $flag
    }
    }
}
}
# If the command line does specify an ABI, just check for the
# If the command line does specify an ABI, just check for the
# appropriate assembler flag.
# appropriate assembler flag.
if {$default_abi != ""} {
if {$default_abi != ""} {
    check_mips_abi "command line" $default_abi ""
    check_mips_abi "command line" $default_abi ""
} else {
} else {
    # An ABI should be passed to the assembler by default.
    # An ABI should be passed to the assembler by default.
    # It doesn't seem worthwhile to duplicate the
    # It doesn't seem worthwhile to duplicate the
    # configuration to ABI logic here, so just accept any ABI.
    # configuration to ABI logic here, so just accept any ABI.
    check_mips_abi "default" $asm_abi_flags ""
    check_mips_abi "default" $asm_abi_flags ""
    # See whether passing a -mabi flag does the right thing.
    # See whether passing a -mabi flag does the right thing.
    foreach abi $asm_abi_flags {
    foreach abi $asm_abi_flags {
        check_mips_abi $abi $abi $abi
        check_mips_abi $abi $abi $abi
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

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