OSDN Git Service

2009-11-20 Paul Brook <paul@codesourcery.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / arm / bpabi.h
1 /* Configuration file for ARM BPABI targets.
2    Copyright (C) 2004, 2005, 2007, 2008, 2009
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 "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 #define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4:--fix-v4bx}"
55
56 #define BE8_LINK_SPEC " %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
57
58 /* Tell the assembler to build BPABI binaries.  */
59 #undef  SUBTARGET_EXTRA_ASM_SPEC
60 #define SUBTARGET_EXTRA_ASM_SPEC "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC
61
62 #ifndef SUBTARGET_EXTRA_LINK_SPEC
63 #define SUBTARGET_EXTRA_LINK_SPEC ""
64 #endif
65
66 /* The generic link spec in elf.h does not support shared libraries.  */
67 #define BPABI_LINK_SPEC \
68   "%{mbig-endian:-EB} %{mlittle-endian:-EL} "           \
69   "%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} "        \
70   "-X" SUBTARGET_EXTRA_LINK_SPEC TARGET_FIX_V4BX_SPEC BE8_LINK_SPEC
71
72 #undef  LINK_SPEC
73 #define LINK_SPEC BPABI_LINK_SPEC
74
75 #if defined (__thumb__)
76 #define RENAME_LIBRARY_SET ".thumb_set"
77 #else
78 #define RENAME_LIBRARY_SET ".set"
79 #endif
80
81 /* Make __aeabi_AEABI_NAME an alias for __GCC_NAME.  */
82 #define RENAME_LIBRARY(GCC_NAME, AEABI_NAME)            \
83   __asm__ (".globl\t__aeabi_" #AEABI_NAME "\n"          \
84            RENAME_LIBRARY_SET "\t__aeabi_" #AEABI_NAME  \
85              ", __" #GCC_NAME "\n");
86
87 /* Give some libgcc functions an additional __aeabi name.  */
88 #ifdef L_muldi3
89 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
90 #endif
91 #ifdef L_muldi3
92 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
93 #endif
94 #ifdef L_fixdfdi
95 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfdi, d2lz) \
96   extern DWtype __fixdfdi (DFtype) __attribute__((pcs("aapcs"))); \
97   extern UDWtype __fixunsdfdi (DFtype) __asm__("__aeabi_d2ulz") __attribute__((pcs("aapcs")));
98 #endif
99 #ifdef L_fixunsdfdi
100 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfdi, d2ulz) \
101   extern UDWtype __fixunsdfdi (DFtype) __attribute__((pcs("aapcs")));
102 #endif
103 #ifdef L_fixsfdi
104 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f2lz) \
105   extern DWtype __fixsfdi (SFtype) __attribute__((pcs("aapcs"))); \
106   extern UDWtype __fixunssfdi (SFtype) __asm__("__aeabi_f2ulz") __attribute__((pcs("aapcs")));
107 #endif
108 #ifdef L_fixunssfdi
109 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f2ulz) \
110   extern UDWtype __fixunssfdi (SFtype) __attribute__((pcs("aapcs")));
111 #endif
112 #ifdef L_floatdidf
113 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdidf, l2d)
114 #endif
115 #ifdef L_floatdisf
116 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, l2f)
117 #endif
118
119 /* These renames are needed on ARMv6M.  Other targets get them from
120    assembly routines.  */
121 #ifdef L_fixunsdfsi
122 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfsi, d2uiz)
123 #endif
124 #ifdef L_fixunssfsi
125 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfsi, f2uiz)
126 #endif
127 #ifdef L_floatundidf
128 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatundidf, ul2d)
129 #endif
130 #ifdef L_floatundisf
131 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatundisf, ul2f)
132 #endif
133
134 /* The BPABI requires that we always use an out-of-line implementation
135    of RTTI comparison, even if the target supports weak symbols,
136    because the same object file might be used on a target that does
137    not support merging symbols across DLL boundaries.  This macro is
138    broken out separately so that it can be used within
139    TARGET_OS_CPP_BUILTINS in configuration files for systems based on
140    the BPABI.  */
141 #define TARGET_BPABI_CPP_BUILTINS()                     \
142   do                                                    \
143     {                                                   \
144       builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0");      \
145     }                                                   \
146   while (false)
147
148 #undef TARGET_OS_CPP_BUILTINS
149 #define TARGET_OS_CPP_BUILTINS() \
150   TARGET_BPABI_CPP_BUILTINS()
151
152 /* The BPABI specifies the use of .{init,fini}_array.  Therefore, we
153    do not want GCC to put anything into the .{init,fini} sections.  */
154 #undef INIT_SECTION_ASM_OP
155 #undef FINI_SECTION_ASM_OP
156 #define INIT_ARRAY_SECTION_ASM_OP ARM_EABI_CTORS_SECTION_OP
157 #define FINI_ARRAY_SECTION_ASM_OP ARM_EABI_DTORS_SECTION_OP
158
159 /* The legacy _mcount implementation assumes r11 points to a
160     4-word APCS frame.  This is generally not true for EABI targets,
161     particularly not in Thumb mode.  We assume the mcount
162     implementation does not require a counter variable (No Counter).
163     Note that __gnu_mcount_nc will be entered with a misaligned stack.
164     This is OK because it uses a special calling convention anyway.  */
165
166 #undef  NO_PROFILE_COUNTERS
167 #define NO_PROFILE_COUNTERS 1
168 #undef  ARM_FUNCTION_PROFILER
169 #define ARM_FUNCTION_PROFILER(STREAM, LABELNO)                          \
170 {                                                                       \
171   fprintf (STREAM, "\tpush\t{lr}\n");                                   \
172   fprintf (STREAM, "\tbl\t__gnu_mcount_nc\n");                          \
173 }
174
175 #undef SUBTARGET_FRAME_POINTER_REQUIRED
176 #define SUBTARGET_FRAME_POINTER_REQUIRED 0
177
178 /* __gnu_mcount_nc restores the original LR value before returning.  Ensure
179    that there is no unnecessary hook set up.  */
180 #undef PROFILE_HOOK