xref: /minix3/external/gpl3/gcc/files/minix-spec.h (revision b1c4ba4ab66acbca4eb1bab1b49a15e96feef93e)
1 /* Base configuration file for all FreeBSD targets.
2    Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
3 
4 This file is part of GCC.
5 
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.  */
20 
21 /* Common MINIX configuration.
22    All MINIX architectures should include this file, which will specify
23    their commonalities.
24 */
25 
26 /* In case we need to know.  */
27 #define USING_CONFIG_MINIX_SPEC 1
28 
29 /* This defines which switch letters take arguments.  On FreeBSD, most of
30    the normal cases (defined in gcc.c) apply, and we also have -h* and
31    -z* options (for the linker) (coming from SVR4).
32    We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
33 
34 #define MINIX_SWITCH_TAKES_ARG(CHAR)					\
35   (DEFAULT_SWITCH_TAKES_ARG (CHAR)					\
36     || (CHAR) == 'h'							\
37     || (CHAR) == 'z' /* ignored by ld */				\
38     || (CHAR) == 'R')
39 
40 /* This defines which multi-letter switches take arguments.  */
41 
42 #define MINIX_WORD_SWITCH_TAKES_ARG(STR)					\
43   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)					\
44    || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")		\
45    || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") 		\
46    || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
47 
48 #define MINIX_TARGET_OS_CPP_BUILTINS()					\
49   do									\
50     {									\
51 		builtin_define ("__minix");				\
52 		MINIX_TARGET_CPU_CPP_BUILTINS();			\
53     }									\
54   while (0)
55 
56 /* Define the default MINIX-specific per-CPU hook code.  */
57 #define MINIX_TARGET_CPU_CPP_BUILTINS() do {} while (0)
58 
59 /* Provide a CPP_SPEC appropriate for MINIX.  We just deal with the GCC
60    option `-posix', and PIC issues.  */
61 
62 #define MINIX_CPP_SPEC "							\
63   %(cpp_cpu)								\
64   %(cpp_arch)								\
65   %{posix:-D_POSIX_SOURCE}"
66 
67 /* Provide a STARTFILE_SPEC appropriate for MINIX.  Here we add
68    the magical crtbegin.o file (see crtstuff.c) which provides part
69 	of the support for getting C++ file-scope static object constructed
70 	before entering `main'.  */
71 
72 #define MINIX_STARTFILE_SPEC \
73   "%{!shared: \
74      %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
75 		       %{!p:%{profile:gcrt0%O%s} \
76 			 %{!profile:crt0%O%s}}}} \
77    crti%O%s %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
78 
79 /* Provide a ENDFILE_SPEC appropriate for MINIX.  Here we tack on
80    the magical crtend.o file (see crtstuff.c) which provides part of
81 	the support for getting C++ file-scope static object constructed
82 	before entering `main', followed by a normal "finalizer" file,
83 	`crtn.o'.  */
84 
85 #define MINIX_ENDFILE_SPEC \
86   "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
87 
88 /* Provide a LIB_SPEC appropriate for MINIX.  Just select the appropriate
89    libc, depending on whether we're doing profiling or need threads support.
90    (similar to the default, except no -lg, and no -p).  */
91 
92 #define MINIX_LIB_SPEC "							\
93   %{pthread: %eThe -pthread option is only supported on MINIX when gcc \
94 is built with the --enable-threads configure-time option.}		\
95   %{!shared:								\
96     %{!pg: -lc}								\
97     %{pg:  -lc_p}							\
98   }"
99 
100 /* Provide a LINK_SPEC appropriate for MINIX.  Here we provide support
101    for the special GCC options -static and -shared, which allow us to
102    link things in one of these three modes by applying the appropriate
103    combinations of options at link-time. We like to support here for
104    as many of the other GNU linker options as possible. But I don't
105    have the time to search for those flags. I am sure how to add
106    support for -soname shared_object_name. H.J.
107 
108    I took out %{v:%{!V:-V}}. It is too much :-(. They can use
109    -Wl,-V.
110 
111    When the -shared link option is used a final link is not being
112    done.  */
113 
114 #define MINIX_LINK_SPEC "							\
115   %{p:%nconsider using `-pg' instead of `-p' with gprof(1) }		\
116   %{v:-V}								\
117   %{assert*} %{R*} %{rpath*} %{defsym*}					\
118   %{shared:-Bshareable %{h*} %{soname*}}				\
119   %{!shared:								\
120     %{!static:								\
121       %{rdynamic:-export-dynamic}					\
122       %{!dynamic-linker:-dynamic-linker %(minix_dynamic_linker) }}	\
123     %{static:-Bstatic}}							\
124   %{symbolic:-Bsymbolic}"
125 
126 
127 /* Under MINIX, just like on NetBSD, the normal location of the various
128  *    *crt*.o files is the /usr/lib directory.  */
129 
130 #undef STANDARD_STARTFILE_PREFIX
131 #define STANDARD_STARTFILE_PREFIX	"/usr/lib/"
132 #undef STANDARD_STARTFILE_PREFIX_1
133 #define STANDARD_STARTFILE_PREFIX_1	"/usr/lib/"
134 
135 #define MINIX_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
136 
137 #define MINIX_SUBTARGET_EXTRA_SPECS \
138   { "minix_dynamic_linker", MINIX_DYNAMIC_LINKER }
139