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