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