xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/arm/bpabi.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1 /* Configuration file for ARM BPABI targets.
2    Copyright (C) 2004-2020 Free Software Foundation, Inc.
3    Contributed by CodeSourcery, LLC
4 
5    This file is part of GCC.
6 
7    GCC is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published
9    by the Free Software Foundation; either version 3, or (at your
10    option) any later version.
11 
12    GCC is distributed in the hope that it will be useful, but WITHOUT
13    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15    License for more details.
16 
17    Under Section 7 of GPL version 3, you are granted additional
18    permissions described in the GCC Runtime Library Exception, version
19    3.1, as published by the Free Software Foundation.
20 
21    You should have received a copy of the GNU General Public License and
22    a copy of the GCC Runtime Library Exception along with this program;
23    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24    <http://www.gnu.org/licenses/>.  */
25 
26 /* Use the AAPCS ABI by default.  */
27 #undef ARM_DEFAULT_ABI
28 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS
29 
30 /* Assume that AAPCS ABIs should adhere to the full BPABI.  */
31 #define TARGET_BPABI (TARGET_AAPCS_BASED)
32 
33 /* BPABI targets use EABI frame unwinding tables.  */
34 #undef ARM_UNWIND_INFO
35 #define ARM_UNWIND_INFO 1
36 
37 /* TARGET_BIG_ENDIAN_DEFAULT is set in
38    config.gcc for big endian configurations.  */
39 #if TARGET_BIG_ENDIAN_DEFAULT
40 #define TARGET_ENDIAN_DEFAULT MASK_BIG_END
41 #else
42 #define TARGET_ENDIAN_DEFAULT 0
43 #endif
44 
45 /* EABI targets should enable interworking by default.  */
46 #undef  TARGET_DEFAULT
47 #define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
48 
49 /* The ARM BPABI functions return a boolean; they use no special
50    calling convention.  */
51 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) TARGET_BPABI
52 
53 /* The BPABI integer comparison routines return { -1, 0, 1 }.  */
54 #define TARGET_LIB_INT_CMP_BIASED !TARGET_BPABI
55 
56 #define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
57   "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
58 
59 #define TARGET_FDPIC_ASM_SPEC ""
60 
61 #define BE8_LINK_SPEC							\
62   "%{!r:%{!mbe32:%:be8_linkopt(%{mlittle-endian:little}"		\
63   "			       %{mbig-endian:big}"			\
64   "			       %{mbe8:be8}"				\
65   "			       %{march=*:arch %*})}}"
66 
67 /* Tell the assembler to build BPABI binaries.  */
68 #undef  SUBTARGET_EXTRA_ASM_SPEC
69 #define SUBTARGET_EXTRA_ASM_SPEC \
70   "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC \
71   TARGET_FDPIC_ASM_SPEC
72 
73 #ifndef SUBTARGET_EXTRA_LINK_SPEC
74 #define SUBTARGET_EXTRA_LINK_SPEC ""
75 #endif
76 
77 /* Split out the EABI common values so other targets can use it.  */
78 #define EABI_LINK_SPEC \
79   TARGET_FIX_V4BX_SPEC BE8_LINK_SPEC
80 
81 /* The generic link spec in elf.h does not support shared libraries.  */
82 #define BPABI_LINK_SPEC \
83   "%{mbig-endian:-EB} %{mlittle-endian:-EL} "		\
84   "%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} "	\
85   "-X" SUBTARGET_EXTRA_LINK_SPEC EABI_LINK_SPEC
86 
87 #undef  LINK_SPEC
88 #define LINK_SPEC BPABI_LINK_SPEC
89 
90 /* The BPABI requires that we always use an out-of-line implementation
91    of RTTI comparison, even if the target supports weak symbols,
92    because the same object file might be used on a target that does
93    not support merging symbols across DLL boundaries.  This macro is
94    broken out separately so that it can be used within
95    TARGET_OS_CPP_BUILTINS in configuration files for systems based on
96    the BPABI.  */
97 #define TARGET_BPABI_CPP_BUILTINS()			\
98   do							\
99     {							\
100       builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0");	\
101     }							\
102   while (false)
103 
104 #undef TARGET_OS_CPP_BUILTINS
105 #define TARGET_OS_CPP_BUILTINS() \
106   TARGET_BPABI_CPP_BUILTINS()
107 
108 /* The BPABI specifies the use of .{init,fini}_array.  Therefore, we
109    do not want GCC to put anything into the .{init,fini} sections.  */
110 #undef INIT_SECTION_ASM_OP
111 #define INIT_SECTION_ASM_OP ""
112 #undef FINI_SECTION_ASM_OP
113 #define FINI_SECTION_ASM_OP ""
114 #define INIT_ARRAY_SECTION_ASM_OP ARM_EABI_CTORS_SECTION_OP
115 #define FINI_ARRAY_SECTION_ASM_OP ARM_EABI_DTORS_SECTION_OP
116 
117 /* The legacy _mcount implementation assumes r11 points to a
118     4-word APCS frame.  This is generally not true for EABI targets,
119     particularly not in Thumb mode.  We assume the mcount
120     implementation does not require a counter variable (No Counter).
121     Note that __gnu_mcount_nc will be entered with a misaligned stack.
122     This is OK because it uses a special calling convention anyway.  */
123 
124 #undef  NO_PROFILE_COUNTERS
125 #define NO_PROFILE_COUNTERS 1
126 #undef  ARM_FUNCTION_PROFILER
127 #define ARM_FUNCTION_PROFILER(STREAM, LABELNO)  			\
128 {									\
129   fprintf (STREAM, "\tpush\t{lr}\n");					\
130   fprintf (STREAM, "\tbl\t__gnu_mcount_nc\n");				\
131 }
132 
133 #undef SUBTARGET_FRAME_POINTER_REQUIRED
134 #define SUBTARGET_FRAME_POINTER_REQUIRED 0
135 
136 /* __gnu_mcount_nc restores the original LR value before returning.  Ensure
137    that there is no unnecessary hook set up.  */
138 #undef PROFILE_HOOK
139