1 /* Definitions for GCC.  Part of the machine description for CRIS.
2    Copyright (C) 2001-2018 Free Software Foundation, Inc.
3    Contributed by Axis Communications.  Written by Hans-Peter Nilsson.
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11 
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public 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 
22 /* After the first "Node:" comment comes all preprocessor directives and
23    attached declarations described in the info files, the "Using and
24    Porting GCC" manual (uapgcc), in the same order as found in the "Target
25    macros" section in the gcc-2.9x CVS edition of 2000-03-17.  FIXME: Not
26    really, but needs an update anyway.
27 
28    There is no generic copy-of-uapgcc comment, you'll have to see uapgcc
29    for that.  If applicable, there is a CRIS-specific comment.  The order
30    of macro definitions follow the order in the manual.  Every section in
31    the manual (node in the info pages) has an introductory `Node:
32    <subchapter>' comment.  If no macros are defined for a section, only
33    the section-comment is present.  */
34 
35 /* This file defines the macros for cris-axis-linux-gnu that are not
36    covered by cris.h, elfos.h and (config/)linux.h.  */
37 
38 /* Make sure we have a valid TARGET_CPU_DEFAULT, so we can assume it
39    and take shortcuts below.  */
40 #ifndef TARGET_CPU_DEFAULT
41 #error "TARGET_CPU_DEFAULT not defined"
42 #elif (TARGET_CPU_DEFAULT+0) != 10 && (TARGET_CPU_DEFAULT+0) != 32
43 #error "TARGET_CPU_DEFAULT must be 10 or 32, or this file be updated"
44 #endif
45 
46 /* Node: Instruction Output */
47 
48 #undef USER_LABEL_PREFIX
49 #define USER_LABEL_PREFIX ""
50 
51 /* Node: Driver */
52 /* These macros are CRIS-specific, but used in target driver macros.  */
53 
54 #undef CRIS_CPP_SUBTARGET_SPEC
55 #if TARGET_CPU_DEFAULT == 32
56 # define CRIS_CPP_SUBTARGET_SPEC \
57   "%{pthread:-D_REENTRANT}\
58    %{!march=*:%{!mcpu=*:-D__arch_v32 -D__CRIS_arch_version=32}}"
59 #else
60 # define CRIS_CPP_SUBTARGET_SPEC \
61   "%{pthread:-D_REENTRANT}\
62    %{!march=*:%{!mcpu=*:-D__arch_v10 -D__CRIS_arch_version=10}}"
63 #endif
64 
65 #undef CRIS_CC1_SUBTARGET_SPEC
66 #if TARGET_CPU_DEFAULT == 32
67 # define CRIS_CC1_SUBTARGET_SPEC \
68  "%{!march=*:%{!mcpu=*:-march=v32}}"
69 #define CRIS_SUBTARGET_DEFAULT_ARCH MASK_AVOID_GOTPLT
70 #else
71 # define CRIS_CC1_SUBTARGET_SPEC \
72  "%{!march=*:%{!mcpu=*:-march=v10}}"
73 #define CRIS_SUBTARGET_DEFAULT_ARCH 0
74 #endif
75 
76 #undef CRIS_ASM_SUBTARGET_SPEC
77 #if TARGET_CPU_DEFAULT == 32
78 # define CRIS_ASM_SUBTARGET_SPEC \
79  "--em=criself \
80   %{!march=*:%{!mcpu=*:--march=v32}} \
81   %{!fleading-underscore:--no-underscore}\
82   %{" FPIE_OR_FPIC_SPEC ": --pic}"
83 #else
84 # define CRIS_ASM_SUBTARGET_SPEC \
85  "--em=criself \
86   %{!march=*:%{!mcpu=*:--march=v10}} \
87   %{!fleading-underscore:--no-underscore}\
88   %{" FPIE_OR_FPIC_SPEC ": --pic}"
89 #endif
90 
91 /* Previously controlled by target_flags.  */
92 #undef TARGET_LINUX
93 #define TARGET_LINUX 1
94 
95 #undef CRIS_SUBTARGET_DEFAULT
96 #define CRIS_SUBTARGET_DEFAULT			\
97   (MASK_SVINTO					\
98    + MASK_ETRAX4_ADD				\
99    + MASK_ALIGN_BY_32				\
100    + CRIS_SUBTARGET_DEFAULT_ARCH)
101 
102 #undef CRIS_DEFAULT_CPU_VERSION
103 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
104 
105 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
106 
107 #undef CRIS_LINK_SUBTARGET_SPEC
108 #define CRIS_LINK_SUBTARGET_SPEC \
109  "-mcrislinux\
110   %{shared} %{static}\
111   %{symbolic:-Bdynamic} %{static:-Bstatic}\
112   %{!shared:%{!static:\
113               %{rdynamic:-export-dynamic}\
114               -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}\
115   %{!r:%{O2|O3: --gc-sections}}"
116 
117 
118 /* Node: Run-time Target */
119 
120 /* For the cris-*-linux* subtarget.  */
121 #undef TARGET_OS_CPP_BUILTINS
122 #define TARGET_OS_CPP_BUILTINS()		\
123   do						\
124     {						\
125       GNU_USER_TARGET_OS_CPP_BUILTINS();	\
126       if (flag_leading_underscore <= 0)		\
127 	builtin_define ("__NO_UNDERSCORES__");	\
128     }						\
129   while (0)
130 
131 /* Node: Type Layout */
132 
133 #undef SIZE_TYPE
134 #define SIZE_TYPE "unsigned int"
135 
136 #undef PTRDIFF_TYPE
137 #define PTRDIFF_TYPE "int"
138 
139 /* Node: Sections */
140 
141 /* GNU/Linux has crti and crtn and does not need the
142    CRT_CALL_STATIC_FUNCTION trick in cris.h.  */
143 #undef CRT_CALL_STATIC_FUNCTION
144 
145 /*
146  * Local variables:
147  * eval: (c-set-style "gnu")
148  * indent-tabs-mode: t
149  * End:
150  */
151