xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/arm/netbsd-eabi.h (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
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 TARGET_VERSION
23 #define TARGET_VERSION fputs (" (NetBSD/earm ELF)", stderr);
24 
25 #undef MULTILIB_DEFAULTS
26 #define MULTILIB_DEFAULTS { "mabi=aapcs-linux" }
27 
28 #undef MUST_USE_SJLJ_EXCEPTIONS
29 #define MUST_USE_SJLJ_EXCEPTIONS (!TARGET_AAPCS_BASED)
30 
31 #undef ARM_EABI_UNWIND_TABLES
32 #define ARM_EABI_UNWIND_TABLES \
33   ((!USING_SJLJ_EXCEPTIONS && flag_exceptions) || flag_unwind_tables)
34 
35 #define TARGET_LINKER_EABI_SUFFIX \
36     (TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT \
37      ? "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}" \
38      : "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}")
39 #define TARGET_LINKER_BIG_EMULATION "armelfb_nbsd%(linker_eabi_suffix)"
40 #define TARGET_LINKER_LITTLE_EMULATION "armelf_nbsd%(linker_eabi_suffix)"
41 
42 /* TARGET_BIG_ENDIAN_DEFAULT is set in
43    config.gcc for big endian configurations.  */
44 #undef  TARGET_LINKER_EMULATION
45 #if TARGET_BIG_ENDIAN_DEFAULT
46 #define TARGET_LINKER_EMULATION TARGET_LINKER_BIG_EMULATION
47 #undef BE8_LINK_SPEC
48 #define BE8_LINK_SPEC " %{!mlittle-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
49 #else
50 #define TARGET_LINKER_EMULATION TARGET_LINKER_LITTLE_EMULATION
51 #endif
52 
53 #undef MULTILIB_DEFAULTS
54 
55 #undef ARM_DEFAULT_ABI
56 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
57 
58 #undef TARGET_OS_CPP_BUILTINS
59 #define TARGET_OS_CPP_BUILTINS()		\
60   do						\
61     {						\
62       if (TARGET_AAPCS_BASED)			\
63 	TARGET_BPABI_CPP_BUILTINS();		\
64       NETBSD_OS_CPP_BUILTINS_ELF();		\
65       if (ARM_EABI_UNWIND_TABLES)		\
66 	builtin_define ("__UNWIND_TABLES__");	\
67     }						\
68   while (0)
69 
70 #undef SUBTARGET_CPP_SPEC
71 #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
72 
73 /*
74  * Override AAPCS types to remain compatible the existing NetBSD types.
75  */
76 #undef WCHAR_TYPE
77 #define WCHAR_TYPE "int"
78 
79 #undef SIZE_TYPE
80 #define SIZE_TYPE "long unsigned int"
81 
82 #undef PTRDIFF_TYPE
83 #define PTRDIFF_TYPE "long int"
84 
85 #undef SUBTARGET_EXTRA_ASM_SPEC
86 #define SUBTARGET_EXTRA_ASM_SPEC	\
87   "-matpcs %{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu} %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
88 
89 /* Default to full VFP if -mhard-float is specified.  */
90 #undef SUBTARGET_ASM_FLOAT_SPEC
91 #define SUBTARGET_ASM_FLOAT_SPEC	\
92   "%{mhard-float:%{!mfpu=*:-mfpu=vfp}}   \
93    %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
94 
95 #undef SUBTARGET_EXTRA_SPECS
96 #define SUBTARGET_EXTRA_SPECS				\
97   { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
98   { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
99   { "netbsd_link_spec",		NETBSD_LINK_SPEC_ELF },	\
100   { "linker_eabi_suffix",	TARGET_LINKER_EABI_SUFFIX }, \
101   { "linker_emulation",		TARGET_LINKER_EMULATION }, \
102   { "linker_big_emulation",	TARGET_LINKER_BIG_EMULATION }, \
103   { "linker_little_emulation",	TARGET_LINKER_LITTLE_EMULATION }, \
104   { "be8_link_spec",		BE8_LINK_SPEC }, \
105   { "target_fix_v4bx_spec",	TARGET_FIX_V4BX_SPEC }, \
106   { "netbsd_entry_point",	NETBSD_ENTRY_POINT },
107 
108 #define NETBSD_ENTRY_POINT "__start"
109 
110 #undef LINK_SPEC
111 #define LINK_SPEC \
112   "-X %{mbig-endian:-EB -m %(linker_big_emulation)} \
113    %{mlittle-endian:-EL -m %(linker_liitle_emulation)} \
114    %{!mbig-endian:%{!mlittle-endian:-m %(linker_emulation)}} \
115    %(be8_link_spec) %(target_fix_v4bx_spec) \
116    %(netbsd_link_spec)"
117