OSDN Git Service

2008-07-08 Doug Kwan <dougkwan@google.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / arm / bpabi.h
1 /* Configuration file for ARM BPABI targets.
2    Copyright (C) 2004, 2005, 2007, 2008
3    Free Software Foundation, Inc.
4    Contributed by CodeSourcery, LLC   
5
6    This file is part of GCC.
7
8    GCC is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published
10    by the Free Software Foundation; either version 3, or (at your
11    option) any later version.
12
13    GCC is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with GCC; see the file COPYING3.  If not see
20    <http://www.gnu.org/licenses/>.  */
21
22 /* Use the AAPCS ABI by default.  */
23 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS
24
25 /* Assume that AAPCS ABIs should adhere to the full BPABI.  */ 
26 #define TARGET_BPABI (TARGET_AAPCS_BASED)
27
28 /* BPABI targets use EABI frame unwinding tables.  */
29 #define TARGET_UNWIND_INFO 1
30
31 /* Section 4.1 of the AAPCS requires the use of VFP format.  */
32 #undef  FPUTYPE_DEFAULT
33 #define FPUTYPE_DEFAULT FPUTYPE_VFP
34
35 /* TARGET_BIG_ENDIAN_DEFAULT is set in
36    config.gcc for big endian configurations.  */
37 #if TARGET_BIG_ENDIAN_DEFAULT
38 #define TARGET_ENDIAN_DEFAULT MASK_BIG_END
39 #else
40 #define TARGET_ENDIAN_DEFAULT 0
41 #endif
42
43 /* EABI targets should enable interworking by default.  */
44 #undef  TARGET_DEFAULT
45 #define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
46
47 /* The ARM BPABI functions return a boolean; they use no special
48    calling convention.  */
49 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) TARGET_BPABI
50
51 /* The BPABI integer comparison routines return { -1, 0, 1 }.  */
52 #define TARGET_LIB_INT_CMP_BIASED !TARGET_BPABI
53
54 /* Tell the assembler to build BPABI binaries.  */
55 #undef  SUBTARGET_EXTRA_ASM_SPEC
56 #define SUBTARGET_EXTRA_ASM_SPEC "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=4}"
57
58 #ifndef SUBTARGET_EXTRA_LINK_SPEC
59 #define SUBTARGET_EXTRA_LINK_SPEC ""
60 #endif
61
62 #define ANDROID_LINK_SPEC \
63 "%{mandroid:" \
64    "%{!static:" \
65       "%{shared: -Bsymbolic} " \
66       "%{!shared:" \
67          "%{rdynamic:-export-dynamic} " \
68          "%{!dynamic-linker:-dynamic-linker /system/bin/linker}}}} "
69
70 /* The generic link spec in elf.h does not support shared libraries.  */
71 #undef  LINK_SPEC
72 #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} "           \
73   "%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} "        \
74   ANDROID_LINK_SPEC                                                     \
75   "-X" SUBTARGET_EXTRA_LINK_SPEC
76
77 #if defined (__thumb__)
78 #define RENAME_LIBRARY_SET ".thumb_set"
79 #else
80 #define RENAME_LIBRARY_SET ".set"
81 #endif
82
83 /* Make __aeabi_AEABI_NAME an alias for __GCC_NAME.  */
84 #define RENAME_LIBRARY(GCC_NAME, AEABI_NAME)            \
85   __asm__ (".globl\t__aeabi_" #AEABI_NAME "\n"          \
86            RENAME_LIBRARY_SET "\t__aeabi_" #AEABI_NAME  \
87              ", __" #GCC_NAME "\n");
88
89 /* Give some libgcc functions an additional __aeabi name.  */
90 #ifdef L_muldi3
91 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
92 #endif
93 #ifdef L_muldi3
94 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
95 #endif
96 #ifdef L_fixdfdi
97 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfdi, d2lz)
98 #endif
99 #ifdef L_fixunsdfdi
100 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfdi, d2ulz)
101 #endif
102 #ifdef L_fixsfdi
103 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f2lz)
104 #endif
105 #ifdef L_fixunssfdi
106 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f2ulz)
107 #endif
108 #ifdef L_floatdidf
109 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdidf, l2d)
110 #endif
111 #ifdef L_floatdisf
112 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, l2f)
113 #endif
114
115 /* These renames are needed on ARMv6M.  Other targets get them from
116    assembly routines.  */
117 #ifdef L_fixunsdfsi
118 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfsi, d2uiz)
119 #endif
120 #ifdef L_fixunssfsi
121 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfsi, f2uiz)
122 #endif
123 #ifdef L_floatundidf
124 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatundidf, ul2d)
125 #endif
126 #ifdef L_floatundisf
127 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatundisf, ul2f)
128 #endif
129
130 /* The BPABI requires that we always use an out-of-line implementation
131    of RTTI comparison, even if the target supports weak symbols,
132    because the same object file might be used on a target that does
133    not support merging symbols across DLL boundaries.  This macro is
134    broken out separately so that it can be used within
135    TARGET_OS_CPP_BUILTINS in configuration files for systems based on
136    the BPABI.  */
137 #define TARGET_BPABI_CPP_BUILTINS()                     \
138   do                                                    \
139     {                                                   \
140       builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0");      \
141       if (TARGET_ANDROID)                               \
142         builtin_define ("__ANDROID__");                 \
143     }                                                   \
144   while (false)
145
146 #undef TARGET_OS_CPP_BUILTINS
147 #define TARGET_OS_CPP_BUILTINS() \
148   TARGET_BPABI_CPP_BUILTINS()
149
150 /* The BPABI specifies the use of .{init,fini}_array.  Therefore, we
151    do not want GCC to put anything into the .{init,fini} sections.  */
152 #undef INIT_SECTION_ASM_OP
153 #undef FINI_SECTION_ASM_OP
154 #define INIT_ARRAY_SECTION_ASM_OP ARM_EABI_CTORS_SECTION_OP
155 #define FINI_ARRAY_SECTION_ASM_OP ARM_EABI_DTORS_SECTION_OP
156
157 /* Android uses -fno-rtti and -fno-exceptions by default. */
158
159 #undef CC1_SPEC
160 #define CC1_SPEC "%{mandroid:%{!fexceptions:-fno-exceptions}}"
161
162 #undef CC1PLUS_SPEC
163 #define CC1PLUS_SPEC "%{mandroid:%{!frtti:-fno-rtti}}"
164
165 /* Startfile and endfile specs are the same as unknown-elf.h except
166    for Android. */
167
168 #undef LIB_SPEC
169 #define LIB_SPEC \
170 "%{!mandroid:%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}} " \
171 "%{mandroid:-lc %{!static:-ldl}}"
172
173 #undef  STARTFILE_SPEC
174 #define STARTFILE_SPEC \
175 "%{!mandroid:crti%O%s crtbegin%O%s crt0%O%s} " \
176 "%{mandroid:" \
177   "%{!shared:" \
178     "%{static:crtbegin_static%O%s} " \
179     "%{!static:crtbegin_dynamic%O%s}}}"
180
181 #undef  ENDFILE_SPEC
182 #define ENDFILE_SPEC \
183 "%{!mandroid:crtend%O%s crtn%O%s} "\
184 "%{mandroid:" \
185   "%{!shared:crtend%O%s}}"