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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [special/] [mips-abi.exp] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
#   Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with GCC; see the file COPYING3.  If not see
15
# .
16
 
17
# This test checks whether MIPS ELF configurations pass the right
18
# ABI flags to the assembler.  An ABI flag should always be passed
19
# unless MEABI is selected.
20
 
21
load_lib gcc-dg.exp
22
 
23
# Only run this test on MIPS ELF targets
24
if {![istarget mips*-*-*] || [gcc_target_object_format] != "elf"} {
25
    return
26
}
27
 
28
# A list of all assembler ABI flags.
29
set asm_abi_flags {-mabi=32 -mabi=n32 -mabi=64 -mabi=o64 -mabi=eabi}
30
 
31
# Try to assemble mips-abi.s (an empty file), passing -v in order to
32
# get the assembler command line.  Check whether an appropriate ABI
33
# flag is passed.
34
#
35
# NAME is a name for the pass/fail line.
36
# ABIS is a list of acceptable assembler ABI flags, or "" if no
37
#   ABI flag is expected.
38
# FLAGS is a list of options for gcc.
39
proc check_mips_abi {name abis flags} {
40
    global srcdir subdir
41
 
42
    lappend flags "-v"
43
    set lines [gcc_target_compile "$srcdir/$subdir/mips-abi.s" \
44
                                  "mips-abi.o" object \
45
                                  [list "additional_flags=$flags"]]
46
    set good 0
47
    set bad 0
48
    foreach line [split $lines "\n"] {
49
        # Find the assembler command line.
50
        if {[string first "$srcdir/$subdir/mips-abi.s" $line] >= 0} {
51
            foreach arg [split $line " "] {
52
                # Count the number of matching and non-matching
53
                # ABI options.
54
                if {[lsearch -exact $abis $arg] >= 0} {
55
                    incr good
56
                } elseif {[string match "-mabi=*" $arg]} {
57
                    incr bad
58
                }
59
            }
60
        }
61
    }
62
    if {$good == ($abis != "") && $bad == 0} {
63
        pass "mips-abi $name"
64
    } else {
65
        fail "mips-abi $name"
66
    }
67
}
68
 
69
# Collect the default target flags.
70
set default_flags ""
71
set target [target_info name]
72
if {[info exists CFLAGS_FOR_TARGET]} {
73
    append default_flags " $CFLAGS_FOR_TARGET"
74
}
75
if {[board_info $target exists cflags]} {
76
    append default_flags " [board_info $target cflags]"
77
}
78
if {[board_info $target exists multilib_flags]} {
79
    append default_flags " [board_info $target multilib_flags]"
80
}
81
 
82
# See whether the default command line specifies an ABI.
83
set default_abi ""
84
foreach flag $default_flags {
85
    if {[string match "-mabi=*" $flag]} {
86
        set default_abi $flag
87
    }
88
}
89
 
90
# If the command line does specify an ABI, just check for the
91
# appropriate assembler flag.
92
if {$default_abi != ""} {
93
    check_mips_abi "command line" $default_abi ""
94
} else {
95
    # An ABI should be passed to the assembler by default.
96
    # It doesn't seem worthwhile to duplicate the
97
    # configuration to ABI logic here, so just accept any ABI.
98
    check_mips_abi "default" $asm_abi_flags ""
99
 
100
    # See whether passing a -mabi flag does the right thing.
101
    foreach abi $asm_abi_flags {
102
        check_mips_abi $abi $abi $abi
103
    }
104
}

powered by: WebSVN 2.1.0

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