xref: /minix3/external/gpl3/gcc/files/minix-spec.h (revision 0cdf705cc6b6351f9bd896cde32607ecf6415eb9)
1*0cdf705cSLionel Sambuc /* Base configuration file for all MINIX targets.
2d19d7d58SLionel Sambuc    Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
3*0cdf705cSLionel Sambuc    Adapted for MINIX by Lionel Sambuc <lionel@minix3.org>
4d19d7d58SLionel Sambuc 
5d19d7d58SLionel Sambuc    This file is part of GCC.
6d19d7d58SLionel Sambuc 
7*0cdf705cSLionel Sambuc    GCC is free software; you can redistribute it and/or modify it
8*0cdf705cSLionel Sambuc    under the terms of the GNU General Public License as published
9*0cdf705cSLionel Sambuc    by the Free Software Foundation; either version 2, or (at your
10*0cdf705cSLionel Sambuc    option) any later version.
11d19d7d58SLionel Sambuc 
12*0cdf705cSLionel Sambuc    GCC is distributed in the hope that it will be useful, but WITHOUT
13*0cdf705cSLionel Sambuc    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14*0cdf705cSLionel Sambuc    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15*0cdf705cSLionel Sambuc    License for more details.
16d19d7d58SLionel Sambuc 
17d19d7d58SLionel Sambuc    You should have received a copy of the GNU General Public License
18*0cdf705cSLionel Sambuc    along with GCC; see the file COPYING.  If not, write to the
19*0cdf705cSLionel Sambuc    Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
20*0cdf705cSLionel Sambuc    MA 02110-1301, USA.  */
21d19d7d58SLionel Sambuc 
22*0cdf705cSLionel Sambuc /* MINIX defines
23*0cdf705cSLionel Sambuc  * Default, architecture independent values for MINIX
24*0cdf705cSLionel Sambuc  *
25*0cdf705cSLionel Sambuc  * For this to work properly, the order in the tm_file variable has
26*0cdf705cSLionel Sambuc  * to be the following:
27*0cdf705cSLionel Sambuc  *   minix-spec.h $arch/minix.h minix.h
28*0cdf705cSLionel Sambuc  *
29*0cdf705cSLionel Sambuc  * minix-spec.h	: specifies default arch-independent values
30*0cdf705cSLionel Sambuc  * $arch/minix.h: redefines as needed default minix values
31*0cdf705cSLionel Sambuc  * minix.h	: maps GCC defines to the minix defines.
32*0cdf705cSLionel Sambuc  *
33*0cdf705cSLionel Sambuc  * WARNING:
34*0cdf705cSLionel Sambuc  *   When changing any default, also check in the arch headers
35*0cdf705cSLionel Sambuc  *   if the default is redefined and update them as required.
36d19d7d58SLionel Sambuc  */
37d19d7d58SLionel Sambuc 
38d19d7d58SLionel Sambuc /* In case we need to know.  */
39d19d7d58SLionel Sambuc #define USING_CONFIG_MINIX_SPEC 1
40d19d7d58SLionel Sambuc 
41d19d7d58SLionel Sambuc /* This defines which switch letters take arguments.  On FreeBSD, most of
42d19d7d58SLionel Sambuc    the normal cases (defined in gcc.c) apply, and we also have -h* and
43d19d7d58SLionel Sambuc    -z* options (for the linker) (coming from SVR4).
44d19d7d58SLionel Sambuc    We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
45d19d7d58SLionel Sambuc #define MINIX_SWITCH_TAKES_ARG(CHAR)					\
46d19d7d58SLionel Sambuc   (DEFAULT_SWITCH_TAKES_ARG (CHAR)					\
47d19d7d58SLionel Sambuc     || (CHAR) == 'h'							\
48d19d7d58SLionel Sambuc     || (CHAR) == 'z' /* ignored by ld */				\
49d19d7d58SLionel Sambuc     || (CHAR) == 'R')
50d19d7d58SLionel Sambuc 
51d19d7d58SLionel Sambuc /* This defines which multi-letter switches take arguments.  */
52d19d7d58SLionel Sambuc #define MINIX_WORD_SWITCH_TAKES_ARG(STR)					\
53d19d7d58SLionel Sambuc   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)					\
54d19d7d58SLionel Sambuc    || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")		\
55d19d7d58SLionel Sambuc    || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") 		\
56d19d7d58SLionel Sambuc    || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
57d19d7d58SLionel Sambuc 
58d19d7d58SLionel Sambuc #define MINIX_TARGET_OS_CPP_BUILTINS()					\
59d19d7d58SLionel Sambuc   do									\
60d19d7d58SLionel Sambuc     {									\
61d19d7d58SLionel Sambuc 		builtin_define ("__minix");				\
62*0cdf705cSLionel Sambuc 		builtin_define ("__minix__");				\
63*0cdf705cSLionel Sambuc 		builtin_define ("__unix__");				\
64*0cdf705cSLionel Sambuc 		builtin_assert ("system=bsd");				\
65*0cdf705cSLionel Sambuc 		builtin_assert ("system=unix");				\
66*0cdf705cSLionel Sambuc 		builtin_assert ("system=minix");			\
67d19d7d58SLionel Sambuc 		MINIX_TARGET_CPU_CPP_BUILTINS();			\
68d19d7d58SLionel Sambuc     }									\
69d19d7d58SLionel Sambuc   while (0)
70d19d7d58SLionel Sambuc 
71d19d7d58SLionel Sambuc /* Define the default MINIX-specific per-CPU hook code.  */
72d19d7d58SLionel Sambuc #define MINIX_TARGET_CPU_CPP_BUILTINS() do {} while (0)
73d19d7d58SLionel Sambuc 
74d19d7d58SLionel Sambuc /* Provide a CPP_SPEC appropriate for MINIX.  We just deal with the GCC
75*0cdf705cSLionel Sambuc    option `-posix'.  */
76*0cdf705cSLionel Sambuc #define MINIX_CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
77d19d7d58SLionel Sambuc 
78*0cdf705cSLionel Sambuc #define MINIX_CC1_SPEC ""
79*0cdf705cSLionel Sambuc 
80*0cdf705cSLionel Sambuc /* Pass -cxx-isystem to cc1plus.  */
81*0cdf705cSLionel Sambuc #define MINIX_CC1PLUS_SPEC "%{cxx-isystem}"
82*0cdf705cSLionel Sambuc 
83*0cdf705cSLionel Sambuc #define MINIX_SUBTARGET_CPP_SPEC ""
84*0cdf705cSLionel Sambuc #define MINIX_SUBTARGET_EXTRA_ASM_SPEC ""
85*0cdf705cSLionel Sambuc #define MINIX_SUBTARGET_ASM_FLOAT_SPEC ""
86*0cdf705cSLionel Sambuc 
87*0cdf705cSLionel Sambuc #define MINIX_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
88*0cdf705cSLionel Sambuc 
89*0cdf705cSLionel Sambuc /* Under MINIX, just like on NetBSD, the normal location of the various
90*0cdf705cSLionel Sambuc  *    *crt*.o files is the /usr/lib directory.  */
91*0cdf705cSLionel Sambuc #define MINIX_STANDARD_STARTFILE_PREFIX	"/usr/lib/"
92*0cdf705cSLionel Sambuc 
93*0cdf705cSLionel Sambuc /* suppress -lgcc - don't include %G (-lgcc) in the libraries */
94*0cdf705cSLionel Sambuc #define MINIX_LINK_GCC_C_SEQUENCE_SPEC "%L"
95d19d7d58SLionel Sambuc 
96d19d7d58SLionel Sambuc /* Provide a STARTFILE_SPEC appropriate for MINIX.  Here we add
97d19d7d58SLionel Sambuc    the magical crtbegin.o file (see crtstuff.c) which provides part
98d19d7d58SLionel Sambuc    of the support for getting C++ file-scope static object constructed
99d19d7d58SLionel Sambuc    before entering `main'.  */
100d19d7d58SLionel Sambuc #define MINIX_STARTFILE_SPEC	\
101d19d7d58SLionel Sambuc   "%{!shared:			\
102*0cdf705cSLionel Sambuc      %{pg:gcrt0%O%s}		\
103*0cdf705cSLionel Sambuc      %{!pg:			\
104*0cdf705cSLionel Sambuc 	 %{p:gcrt0%O%s}		\
105f14fb602SLionel Sambuc 	 %{!p:%{profile:gcrt0%O%s} \
106f14fb602SLionel Sambuc 	      %{!profile:crt0%O%s}}}} \
107*0cdf705cSLionel Sambuc    %:if-exists(crti%O%s)	\
108*0cdf705cSLionel Sambuc    %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
109*0cdf705cSLionel Sambuc    %{!static:                   \
110*0cdf705cSLionel Sambuc      %{!shared:			\
111*0cdf705cSLionel Sambuc 	 %{!pie:crtbegin%O%s}	\
112*0cdf705cSLionel Sambuc 	 %{pie:crtbeginS%O%s}}	\
113*0cdf705cSLionel Sambuc      %{shared:crtbeginS%O%s}}"
114d19d7d58SLionel Sambuc 
115*0cdf705cSLionel Sambuc /* Provide an ENDFILE_SPEC appropriate for NetBSD ELF.  Here we
116*0cdf705cSLionel Sambuc    add crtend.o, which provides part of the support for getting
117*0cdf705cSLionel Sambuc    C++ file-scope static objects deconstructed after exiting "main".  */
118d19d7d58SLionel Sambuc #define MINIX_ENDFILE_SPEC	\
119*0cdf705cSLionel Sambuc   "%{!shared:                   \
120*0cdf705cSLionel Sambuc     %{!pie:crtend%O%s}          \
121*0cdf705cSLionel Sambuc     %{pie:crtendS%O%s}}         \
122*0cdf705cSLionel Sambuc    %{shared:crtendS%O%s}        \
123*0cdf705cSLionel Sambuc    %:if-exists(crtn%O%s)"
124d19d7d58SLionel Sambuc 
125d19d7d58SLionel Sambuc /* Provide a LIB_SPEC appropriate for MINIX.  Just select the appropriate
126d19d7d58SLionel Sambuc    libc, depending on whether we're doing profiling or need threads support.
127d19d7d58SLionel Sambuc    (similar to the default, except no -lg, and no -p).  */
128d19d7d58SLionel Sambuc #define MINIX_LIB_SPEC "						\
129b86af8beSLionel Sambuc %{pthread: %eThe -pthread option is only supported on MINIX when gcc	\
130d19d7d58SLionel Sambuc is built with the --enable-threads configure-time option.}		\
131*0cdf705cSLionel Sambuc   %{shared:-lc}			\
132d19d7d58SLionel Sambuc   %{!shared:			\
133*0cdf705cSLionel Sambuc     %{!symbolic:		\
134*0cdf705cSLionel Sambuc       %{!p:			\
135*0cdf705cSLionel Sambuc 	%{!pg:-lc}}		\
136*0cdf705cSLionel Sambuc       %{p:-lc_p}		\
137*0cdf705cSLionel Sambuc       %{pg:-lc_p}}}"
138d19d7d58SLionel Sambuc 
139b86af8beSLionel Sambuc /* Provide a LINK_SPEC appropriate for MINIX.  Here we provide support
140b86af8beSLionel Sambuc    for the special GCC options -static and -shared, which allow us to
141b86af8beSLionel Sambuc    link things in one of these three modes by applying the appropriate
142b86af8beSLionel Sambuc    combinations of options at link-time. We like to support here for
143b86af8beSLionel Sambuc    as many of the other GNU linker options as possible. But I don't
144b86af8beSLionel Sambuc    have the time to search for those flags. I am sure how to add
145b86af8beSLionel Sambuc    support for -soname shared_object_name. H.J.
146b86af8beSLionel Sambuc 
147b86af8beSLionel Sambuc    I took out %{v:%{!V:-V}}. It is too much :-(. They can use
148b86af8beSLionel Sambuc    -Wl,-V.
149b86af8beSLionel Sambuc 
150b86af8beSLionel Sambuc    When the -shared link option is used a final link is not being
151b86af8beSLionel Sambuc    done.  */
152b86af8beSLionel Sambuc #define MINIX_LINK_SPEC "						\
153*0cdf705cSLionel Sambuc   -X									\
154b86af8beSLionel Sambuc   %{p:%nconsider using `-pg' instead of `-p' with gprof(1) }		\
155*0cdf705cSLionel Sambuc   %{assert*} %{R*} %{rpath*}						\
156b86af8beSLionel Sambuc   %{shared:-Bshareable %{h*} %{soname*}}				\
157*0cdf705cSLionel Sambuc   %{symbolic:-Bsymbolic}						\
158b86af8beSLionel Sambuc   %{!shared:								\
159*0cdf705cSLionel Sambuc     -dc -dp								\
160b86af8beSLionel Sambuc     %{!static:								\
161b86af8beSLionel Sambuc       %{rdynamic:-export-dynamic}					\
162b86af8beSLionel Sambuc       %{!dynamic-linker:-dynamic-linker %(minix_dynamic_linker) }}	\
163*0cdf705cSLionel Sambuc     %{static:-Bstatic}}"
164