OSDN Git Service

* config/alpha/osf.h (ASM_OUTPUT_WEAK_ALIAS, ASM_WEAKEN_LABEL,
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / lib / target-supports.exp
1 #   Copyright (C) 1999, 2001 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 2 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 this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # gcc-patches@gcc.gnu.org
19
20 # This file defines procs for determining features supported by the target.
21
22 ###############################
23 # proc check_weak_available { }
24 ###############################
25
26 # weak symbols are only supported in some configs/object formats
27 # this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
28
29 proc check_weak_available { } {
30     global target_triplet
31     global target_cpu
32
33     # All mips targets should support it
34     
35     if { [ string first "mips" $target_cpu ] >= 0 } {
36         return 1
37     }
38
39     # DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
40
41     if { [regexp "alpha.*osf.*" $target_triplet] } {
42         return 1
43     }
44
45     # ELF and ECOFF support it. a.out does with gas/gld but may also with
46     # other linkers, so we should try it
47
48     set objformat [gcc_target_object_format]
49
50     switch $objformat {
51         elf      { return 1 }
52         ecoff    { return 1 }
53         a.out    { return 1 }
54         unknown  { return -1 }
55         default  { return 0 }
56     }
57 }
58
59 ###############################
60 # proc check_alias_available { }
61 ###############################
62
63 # Determine if the target toolchain supports the alias attribute.
64 # Parameter is the pathname of a file that can be used to test the alias support.
65 # Returns yes if it does.
66 # Returns no if it does not.
67 # Returns dontknow if something went wrong
68 # For an example of the use of this function, see gcc.dg/special/ecos.exp
69
70 proc check_alias_available { testfile } {
71     global alias_available_saved
72     
73     if [info exists alias_available_saved] {
74         verbose "check_alias_available  returning saved $alias_available_saved" 2
75     } else {
76         verbose "check_alias_available  compiling testfile $testfile" 2
77         set lines [gcc_target_compile $testfile "tmp.o" object ""]
78         
79         if [string match "" $lines] then {
80             # No error messages, everything is OK.
81             set alias_available_saved yes
82         } else {
83             if [regexp "alias definitions not supported" $lines] {
84                 verbose "check_alias_available  target does not support aliases" 2
85
86                 set objformat [gcc_target_object_format]
87
88                 if { $objformat == "elf" } {
89                     verbose "check_alias_available  but target uses ELF format, so it ought to" 2
90                     set alias_available_saved dontknow
91                 } else {
92                     set alias_available_saved no
93                 }
94             } else {
95                 if [regexp "only weak aliases are supported" $lines] {
96                 verbose "check_alias_available  target supports only weak aliases" 2
97                 set alias_available_saved no
98                 } else {
99                     set alias_available_saved dontknow
100                 }
101             }
102         }
103         
104         verbose "check_alias_available  returning $alias_available_saved" 2
105     }
106
107     return $alias_available_saved
108 }