OSDN Git Service

Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.
[pf3gnuchains/gcc-fork.git] / gcc / config / svr4.h
1 /* Operating system specific defines to be used when targeting GCC for some
2    generic System V Release 4 system.
3    Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999,
4    2000, 2001, 2007, 2008, 2009 Free Software Foundation, Inc.
5    Contributed by Ron Guilmette (rfg@monkeys.com).
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
22
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
26 <http://www.gnu.org/licenses/>.  */
27
28
29 /* To use this file, make up a line like that in config.gcc:
30
31         tm_file="$tm_file elfos.h svr4.h MACHINE/svr4.h"
32
33    where MACHINE is replaced by the name of the basic hardware that you
34    are targeting for.  Then, in the file MACHINE/svr4.h, put any really
35    system-specific defines (or overrides of defines) which you find that
36    you need.
37 */
38
39 /* Define a symbol indicating that we are using svr4.h.  */
40 #define USING_SVR4_H
41
42 /* Cpp, assembler, linker, library, and startfile spec's.  */
43
44 /* This defines which switch letters take arguments.  On svr4, most of
45    the normal cases (defined in gcc.c) apply, and we also have -h* and
46    -z* options (for the linker).  Note however that there is no such
47    thing as a -T option for svr4.  */
48
49 #undef  SWITCH_TAKES_ARG
50 #define SWITCH_TAKES_ARG(CHAR)          \
51   (DEFAULT_SWITCH_TAKES_ARG (CHAR)      \
52    || (CHAR) == 'h'                     \
53    || (CHAR) == 'x'                     \
54    || (CHAR) == 'z')
55
56 /* This defines which multi-letter switches take arguments.  On svr4,
57    there are no such switches except those implemented by GCC itself.  */
58
59 #define WORD_SWITCH_TAKES_ARG(STR)                      \
60  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                   \
61   && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")     \
62   && strcmp (STR, "Tbss"))
63
64 /* Provide an ASM_SPEC appropriate for svr4.
65    If we're not using GAS, we try to support as
66    many of the specialized svr4 assembler options as seems reasonable,
67    given that there are certain options which we can't (or shouldn't)
68    support directly due to the fact that they conflict with other options
69    for other svr4 tools (e.g. ld) or with other options for GCC itself.
70    For example, we don't support the -o (output file) or -R (remove
71    input file) options because GCC already handles these things.  We
72    also don't support the -m (run m4) option for the assembler because
73    that conflicts with the -m (produce load map) option of the svr4
74    linker.  We do however allow passing arbitrary options to the svr4
75    assembler via the -Wa, option.
76
77    Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
78    option.
79
80    The svr4 assembler wants '-' on the command line if it's expected to
81    read its stdin.
82 */
83
84 #ifdef USE_GAS
85 #define SVR4_ASM_SPEC \
86   "%{v:-V} %{Wa,*:%*}"
87 #else
88 #define SVR4_ASM_SPEC \
89   "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
90 #endif
91
92 #undef  ASM_SPEC
93 #define ASM_SPEC SVR4_ASM_SPEC
94
95 #define AS_NEEDS_DASH_FOR_PIPED_INPUT
96
97 /* Under svr4, the normal location of the `ld' and `as' programs is the
98    /usr/ccs/bin directory.  */
99
100 #ifndef CROSS_DIRECTORY_STRUCTURE
101 #undef  MD_EXEC_PREFIX
102 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
103 #endif
104
105 /* Under svr4, the normal location of the various *crt*.o files is the
106    /usr/ccs/lib directory.  */
107
108 #ifndef CROSS_DIRECTORY_STRUCTURE
109 #undef  MD_STARTFILE_PREFIX
110 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
111 #endif
112
113 /* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
114    standard C library (unless we are building a shared library).  */
115
116 #undef  LIB_SPEC
117 #define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
118
119 /* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
120    magical crtend.o file (see crtstuff.c) which provides part of the
121    support for getting C++ file-scope static object constructed before
122    entering `main', followed by the normal svr3/svr4 "finalizer" file,
123    which is either `gcrtn.o' or `crtn.o'.  */
124
125 #undef  ENDFILE_SPEC
126 #define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
127
128 /* Provide a LINK_SPEC appropriate for svr4.  Here we provide support
129    for the special GCC options -static, -shared, and -symbolic which
130    allow us to link things in one of these three modes by applying the
131    appropriate combinations of options at link-time.  We also provide
132    support here for as many of the other svr4 linker options as seems
133    reasonable, given that some of them conflict with options for other
134    svr4 tools (e.g. the assembler).  In particular, we do support the
135    -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*, -l*,
136    -o*, -r, -s, -u*, and -L* options are directly supported by gcc.c
137    itself.  We don't directly support the -m (generate load map)
138    option because that conflicts with the -m (run m4) option of the
139    svr4 assembler.  We also don't directly support the svr4 linker's
140    -I* or -M* options because these conflict with existing GCC
141    options.  We do however allow passing arbitrary options to the svr4
142    linker via the -Wl, option, in gcc.c.  We don't support the svr4
143    linker's -a option at all because it is totally useless and because
144    it conflicts with GCC's own -a option.
145
146    Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
147
148    When the -G link option is used (-shared and -symbolic) a final link is
149    not being done.  */
150
151 #undef  LINK_SPEC
152 #ifdef CROSS_DIRECTORY_STRUCTURE
153 #define LINK_SPEC "%{h*} %{v:-V} \
154                    %{b} \
155                    %{static:-dn -Bstatic} \
156                    %{shared:-G -dy -z text} \
157                    %{symbolic:-Bsymbolic -G -dy -z text} \
158                    %{G:-G} \
159                    %{YP,*} \
160                    %{Qy:} %{!Qn:-Qy}"
161 #else
162 #define LINK_SPEC "%{h*} %{v:-V} \
163                    %{b} \
164                    %{static:-dn -Bstatic} \
165                    %{shared:-G -dy -z text} \
166                    %{symbolic:-Bsymbolic -G -dy -z text} \
167                    %{G:-G} \
168                    %{YP,*} \
169                    %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
170                     %{!p:-Y P,/usr/ccs/lib:/usr/lib}} \
171                    %{Qy:} %{!Qn:-Qy}"
172 #endif
173
174 /* Gcc automatically adds in one of the files /usr/ccs/lib/values-Xc.o
175    or /usr/ccs/lib/values-Xa.o for each final link step (depending
176    upon the other gcc options selected, such as -ansi).  These files
177    each contain one (initialized) copy of a special variable called
178    `_lib_version'.  Each one of these files has `_lib_version' initialized
179    to a different (enum) value.  The SVR4 library routines query the
180    value of `_lib_version' at run to decide how they should behave.
181    Specifically, they decide (based upon the value of `_lib_version')
182    if they will act in a strictly ANSI conforming manner or not.  */
183
184 #undef  STARTFILE_SPEC
185 #define STARTFILE_SPEC "%{!shared: \
186                          %{!symbolic: \
187                           %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
188                         %{pg:gcrti.o%s}%{!pg:crti.o%s} \
189                         %{ansi:values-Xc.o%s} \
190                         %{!ansi:values-Xa.o%s} \
191                         crtbegin.o%s"
192
193 /* The numbers used to denote specific machine registers in the System V
194    Release 4 DWARF debugging information are quite likely to be totally
195    different from the numbers used in BSD stabs debugging information
196    for the same kind of target machine.  Thus, we undefine the macro
197    DBX_REGISTER_NUMBER here as an extra inducement to get people to
198    provide proper machine-specific definitions of DBX_REGISTER_NUMBER
199    (which is also used to provide DWARF registers numbers in dwarfout.c)
200    in their tm.h files which include this file.  */
201
202 #undef DBX_REGISTER_NUMBER
203
204 /* Define the actual types of some ANSI-mandated types.  (These
205    definitions should work for most SVR4 systems).  */
206
207 #undef  SIZE_TYPE
208 #define SIZE_TYPE "unsigned int"
209
210 #undef  PTRDIFF_TYPE
211 #define PTRDIFF_TYPE "int"
212
213 #undef  WCHAR_TYPE
214 #define WCHAR_TYPE "long int"
215
216 #undef  WCHAR_TYPE_SIZE
217 #define WCHAR_TYPE_SIZE BITS_PER_WORD
218
219 #define TARGET_POSIX_IO