xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/arm/bpabi.h (revision 19ef5b5b0bcb90f63509df6e78769de1b57c2758)
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 #undef ARM_DEFAULT_ABI
24 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS
25 
26 /* Assume that AAPCS ABIs should adhere to the full BPABI.  */
27 #undef TARGET_BPABI
28 #define TARGET_BPABI (TARGET_AAPCS_BASED)
29 
30 /* BPABI targets use EABI frame unwinding tables.  */
31 #undef MUST_USE_SJLJ_EXCEPTIONS
32 #define TARGET_UNWIND_INFO 1
33 #undef ARM_EABI_UNWIND_TABLES
34 #define ARM_EABI_UNWIND_TABLES 1
35 
36 /* Section 4.1 of the AAPCS requires the use of VFP format.  */
37 #undef  FPUTYPE_DEFAULT
38 #define FPUTYPE_DEFAULT "vfp"
39 
40 /* TARGET_BIG_ENDIAN_DEFAULT is set in
41    config.gcc for big endian configurations.  */
42 #if TARGET_BIG_ENDIAN_DEFAULT
43 #define TARGET_ENDIAN_DEFAULT MASK_BIG_END
44 #else
45 #define TARGET_ENDIAN_DEFAULT 0
46 #endif
47 
48 /* EABI targets should enable interworking by default.  */
49 #undef  TARGET_DEFAULT
50 #define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
51 
52 /* The ARM BPABI functions return a boolean; they use no special
53    calling convention.  */
54 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) TARGET_BPABI
55 
56 /* The BPABI integer comparison routines return { -1, 0, 1 }.  */
57 #define TARGET_LIB_INT_CMP_BIASED !TARGET_BPABI
58 
59 #define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4:--fix-v4bx}"
60 
61 #define BE8_LINK_SPEC " %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
62 
63 /* Tell the assembler to build BPABI binaries.  */
64 #undef  SUBTARGET_EXTRA_ASM_SPEC
65 #define SUBTARGET_EXTRA_ASM_SPEC "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC
66 
67 #ifndef SUBTARGET_EXTRA_LINK_SPEC
68 #define SUBTARGET_EXTRA_LINK_SPEC ""
69 #endif
70 
71 /* The generic link spec in elf.h does not support shared libraries.  */
72 #define BPABI_LINK_SPEC \
73   "%{mbig-endian:-EB} %{mlittle-endian:-EL} "		\
74   "%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} "	\
75   "-X" SUBTARGET_EXTRA_LINK_SPEC TARGET_FIX_V4BX_SPEC BE8_LINK_SPEC
76 
77 #undef  LINK_SPEC
78 #define LINK_SPEC BPABI_LINK_SPEC
79 
80 /* Make __aeabi_AEABI_NAME an alias for __GCC_NAME.  */
81 #define RENAME_LIBRARY(GCC_NAME, AEABI_NAME)		\
82   typeof (__##GCC_NAME) __aeabi_##AEABI_NAME \
83     __attribute__((alias ("__" #GCC_NAME)));
84 
85 /* Give some libgcc functions an additional __aeabi name.  */
86 #ifdef L_muldi3
87 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
88 #endif
89 #ifdef L_muldi3
90 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
91 #endif
92 #ifdef L_fixdfdi
93 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfdi, d2lz) \
94   extern DWtype __fixdfdi (DFtype) __attribute__((pcs("aapcs"))); \
95   extern UDWtype __fixunsdfdi (DFtype) __asm__("__aeabi_d2ulz") __attribute__((pcs("aapcs")));
96 #endif
97 #ifdef L_fixunsdfdi
98 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfdi, d2ulz) \
99   extern UDWtype __fixunsdfdi (DFtype) __attribute__((pcs("aapcs")));
100 #endif
101 #ifdef L_fixsfdi
102 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f2lz) \
103   extern DWtype __fixsfdi (SFtype) __attribute__((pcs("aapcs"))); \
104   extern UDWtype __fixunssfdi (SFtype) __asm__("__aeabi_f2ulz") __attribute__((pcs("aapcs")));
105 #endif
106 #ifdef L_fixunssfdi
107 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f2ulz) \
108   extern UDWtype __fixunssfdi (SFtype) __attribute__((pcs("aapcs")));
109 #endif
110 #ifdef L_floatdidf
111 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdidf, l2d)
112 #endif
113 #ifdef L_floatdisf
114 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, l2f)
115 #endif
116 
117 /* These renames are needed on ARMv6M.  Other targets get them from
118    assembly routines.  */
119 #ifdef L_fixunsdfsi
120 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfsi, d2uiz)
121 #endif
122 #ifdef L_fixunssfsi
123 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfsi, f2uiz)
124 #endif
125 #ifdef L_floatundidf
126 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatundidf, ul2d)
127 #endif
128 #ifdef L_floatundisf
129 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatundisf, ul2f)
130 #endif
131 
132 /* The BPABI requires that we always use an out-of-line implementation
133    of RTTI comparison, even if the target supports weak symbols,
134    because the same object file might be used on a target that does
135    not support merging symbols across DLL boundaries.  This macro is
136    broken out separately so that it can be used within
137    TARGET_OS_CPP_BUILTINS in configuration files for systems based on
138    the BPABI.  */
139 #define TARGET_BPABI_CPP_BUILTINS()			\
140   do							\
141     {							\
142       builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0");	\
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 /* The legacy _mcount implementation assumes r11 points to a
158     4-word APCS frame.  This is generally not true for EABI targets,
159     particularly not in Thumb mode.  We assume the mcount
160     implementation does not require a counter variable (No Counter).
161     Note that __gnu_mcount_nc will be entered with a misaligned stack.
162     This is OK because it uses a special calling convention anyway.  */
163 
164 #undef  NO_PROFILE_COUNTERS
165 #define NO_PROFILE_COUNTERS 1
166 #undef  ARM_FUNCTION_PROFILER
167 #define ARM_FUNCTION_PROFILER(STREAM, LABELNO)  			\
168 {									\
169   fprintf (STREAM, "\tpush\t{lr}\n");					\
170   fprintf (STREAM, "\tbl\t__gnu_mcount_nc\n");				\
171 }
172 
173 #undef SUBTARGET_FRAME_POINTER_REQUIRED
174 #define SUBTARGET_FRAME_POINTER_REQUIRED 0
175 
176 /* __gnu_mcount_nc restores the original LR value before returning.  Ensure
177    that there is no unnecessary hook set up.  */
178 #undef PROFILE_HOOK
179