xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/arm/netbsd-eabi.h (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1 /* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
2    Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
3    Contributed by Wasabi Systems, Inc.
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    You should have received a copy of the GNU General Public License
18    along with GCC; see the file COPYING3.  If not see
19    <http://www.gnu.org/licenses/>.  */
20 
21 /* Run-time Target Specification.  */
22 #undef MULTILIB_DEFAULTS
23 #define MULTILIB_DEFAULTS { "mabi=aapcs-linux" }
24 
25 #define TARGET_LINKER_EABI_SUFFIX \
26     (TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT \
27      ? "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}" \
28      : "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}")
29 #define TARGET_LINKER_BIG_EMULATION "armelfb_nbsd%(linker_eabi_suffix)"
30 #define TARGET_LINKER_LITTLE_EMULATION "armelf_nbsd%(linker_eabi_suffix)"
31 
32 /* TARGET_BIG_ENDIAN_DEFAULT is set in
33    config.gcc for big endian configurations.  */
34 #undef  TARGET_LINKER_EMULATION
35 #if TARGET_BIG_ENDIAN_DEFAULT
36 #define TARGET_LINKER_EMULATION TARGET_LINKER_BIG_EMULATION
37 #undef BE8_LINK_SPEC
38 #define BE8_LINK_SPEC " %{!mlittle-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
39 #else
40 #define TARGET_LINKER_EMULATION TARGET_LINKER_LITTLE_EMULATION
41 #endif
42 
43 #undef ARM_DEFAULT_ABI
44 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
45 
46 #undef ARM_EABI_UNWIND_TABLES
47 #define ARM_EABI_UNWIND_TABLES 0
48 #undef ARM_UNWIND_INFO
49 #define ARM_UNWIND_INFO 0
50 #undef ARM_DWARF_UNWIND_TABLES
51 #define ARM_DWARF_UNWIND_TABLES 1
52 
53 #undef TARGET_OS_CPP_BUILTINS
54 #define TARGET_OS_CPP_BUILTINS()		\
55   do						\
56     {						\
57       if (TARGET_AAPCS_BASED)			\
58 	TARGET_BPABI_CPP_BUILTINS();		\
59       NETBSD_OS_CPP_BUILTINS_ELF();		\
60       if (ARM_DWARF_UNWIND_TABLES)		\
61 	builtin_define ("__ARM_DWARF_EH__");	\
62       if (ARM_EABI_UNWIND_TABLES)		\
63 	builtin_define ("__UNWIND_TABLES__");	\
64     }						\
65   while (0)
66 
67 #undef SUBTARGET_CPP_SPEC
68 #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
69 
70 /*
71  * Override AAPCS types to remain compatible the existing NetBSD types.
72  */
73 #undef WCHAR_TYPE
74 #define WCHAR_TYPE "int"
75 
76 #undef SIZE_TYPE
77 #define SIZE_TYPE "long unsigned int"
78 
79 #undef PTRDIFF_TYPE
80 #define PTRDIFF_TYPE "long int"
81 
82 #undef SUBTARGET_EXTRA_ASM_SPEC
83 #define SUBTARGET_EXTRA_ASM_SPEC	\
84   "-matpcs %{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu} %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
85 
86 /* Default to full VFP if -mhard-float is specified.  */
87 #undef SUBTARGET_ASM_FLOAT_SPEC
88 #define SUBTARGET_ASM_FLOAT_SPEC	\
89   "%{mhard-float:%{!mfpu=*:-mfpu=vfp}}   \
90    %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
91 
92 #undef SUBTARGET_EXTRA_SPECS
93 #define SUBTARGET_EXTRA_SPECS				\
94   { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
95   { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
96   { "linker_eabi_suffix",	TARGET_LINKER_EABI_SUFFIX }, \
97   { "linker_emulation",		TARGET_LINKER_EMULATION }, \
98   { "linker_big_emulation",	TARGET_LINKER_BIG_EMULATION }, \
99   { "linker_little_emulation",	TARGET_LINKER_LITTLE_EMULATION }, \
100   { "be8_link_spec",		BE8_LINK_SPEC }, \
101   { "target_fix_v4bx_spec",	TARGET_FIX_V4BX_SPEC }, \
102   NETBSD_SUBTARGET_EXTRA_SPECS
103 
104 #define NETBSD_ENTRY_POINT "__start"
105 
106 #undef LINK_SPEC
107 #define LINK_SPEC \
108   "-X %{mbig-endian:-EB -m %(linker_big_emulation)} \
109    %{mlittle-endian:-EL -m %(linker_liitle_emulation)} \
110    %{!mbig-endian:%{!mlittle-endian:-m %(linker_emulation)}} \
111    %(be8_link_spec) %(target_fix_v4bx_spec) \
112    %(netbsd_link_spec)"
113