OSDN Git Service

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