1132718Skan/* Operating system specific defines to be used when targeting GCC for
2132718Skan   Sequent's Dynix/ptx v4 and later.
3169689Skan   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
4169689Skan   Free Software Foundation, Inc.
5132718Skan   Generic SysV4 file Contributed by Ron Guilmette (rfg@monkeys.com).
650397Sobrien   Renamed and changed to suit Dynix/ptx v4 and later.
750397Sobrien   Modified by Tim Wright (timw@sequent.com).
890075Sobrien   Modified by Janis Johnson (janis@us.ibm.com).
950397Sobrien
10132718SkanThis file is part of GCC.
1150397Sobrien
12132718SkanGCC is free software; you can redistribute it and/or modify
1350397Sobrienit under the terms of the GNU General Public License as published by
1450397Sobrienthe Free Software Foundation; either version 2, or (at your option)
1550397Sobrienany later version.
1650397Sobrien
17132718SkanGCC is distributed in the hope that it will be useful,
1850397Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1950397SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2050397SobrienGNU General Public License for more details.
2150397Sobrien
2250397SobrienYou should have received a copy of the GNU General Public License
23132718Skanalong with GCC; see the file COPYING.  If not, write to
24169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
25169689SkanBoston, MA 02110-1301, USA.
2650397Sobrien
2750397Sobrien*/
2850397Sobrien
2950397Sobrien/* Define a symbol indicating that we are using svr4.h.  */
3050397Sobrien#define USING_SVR4_H
3150397Sobrien
32132718Skan/* Use DWARF 2 debugging info by default.  */
3350397Sobrien
3490075Sobrien#undef PREFERRED_DEBUGGING_TYPE
35132718Skan#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
3690075Sobrien
37132718Skan#define DWARF2_DEBUGGING_INFO 1
3890075Sobrien
3950397Sobrien/* Cpp, assembler, linker, library, and startfile spec's.  */
4050397Sobrien
4150397Sobrien/* This defines which switch letters take arguments.  On svr4, most of
4250397Sobrien   the normal cases (defined in gcc.c) apply, and we also have -h* and
4350397Sobrien   -z* options (for the linker).  Note however that there is no such
4450397Sobrien   thing as a -T option for svr4.  */
4550397Sobrien
4650397Sobrien#define SWITCH_TAKES_ARG(CHAR) \
4750397Sobrien  (   (CHAR) == 'D' \
4850397Sobrien   || (CHAR) == 'U' \
4950397Sobrien   || (CHAR) == 'o' \
5050397Sobrien   || (CHAR) == 'e' \
5150397Sobrien   || (CHAR) == 'u' \
5250397Sobrien   || (CHAR) == 'I' \
5350397Sobrien   || (CHAR) == 'm' \
5450397Sobrien   || (CHAR) == 'L' \
5550397Sobrien   || (CHAR) == 'A' \
5650397Sobrien   || (CHAR) == 'h' \
5750397Sobrien   || (CHAR) == 'z')
5850397Sobrien
5950397Sobrien/* This defines which multi-letter switches take arguments.  On svr4,
6050397Sobrien   there are no such switches except those implemented by GCC itself.  */
6150397Sobrien
6250397Sobrien#define WORD_SWITCH_TAKES_ARG(STR)			\
6350397Sobrien (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
6450397Sobrien  && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")	\
6550397Sobrien  && strcmp (STR, "Tbss"))
6650397Sobrien
6750397Sobrien/* Provide an ASM_SPEC appropriate for svr4.  Here we try to support as
6850397Sobrien   many of the specialized svr4 assembler options as seems reasonable,
6950397Sobrien   given that there are certain options which we can't (or shouldn't)
7050397Sobrien   support directly due to the fact that they conflict with other options
7150397Sobrien   for other svr4 tools (e.g. ld) or with other options for GCC itself.
7250397Sobrien   For example, we don't support the -o (output file) or -R (remove
7350397Sobrien   input file) options because GCC already handles these things.  We
7450397Sobrien   also don't support the -m (run m4) option for the assembler because
7550397Sobrien   that conflicts with the -m (produce load map) option of the svr4
7650397Sobrien   linker.  We do however allow passing arbitrary options to the svr4
7750397Sobrien   assembler via the -Wa, option.
7850397Sobrien
7950397Sobrien   Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
8050397Sobrien   option.
8150397Sobrien*/
8250397Sobrien
8350397Sobrien#undef ASM_SPEC
8490075Sobrien#ifdef USE_GAS
8550397Sobrien#define ASM_SPEC \
8690075Sobrien  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
8790075Sobrien#else
8890075Sobrien#define ASM_SPEC \
8990075Sobrien  "-no_0f_fix -no_eflags_chk %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
9090075Sobrien#endif
9150397Sobrien
92132718Skan#define AS_NEEDS_DASH_FOR_PIPED_INPUT
9350397Sobrien
9450397Sobrien/* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
9550397Sobrien   standard C library (unless we are building a shared library).  */
9650397Sobrien
9750397Sobrien#undef	LIB_SPEC
9850397Sobrien#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
9950397Sobrien
10050397Sobrien/* Provide a LIBGCC_SPEC appropriate for svr4.  We also want to exclude
10150397Sobrien   libgcc when -symbolic.  */
10250397Sobrien
10350397Sobrien#undef  LIBGCC_SPEC
10450397Sobrien#define LIBGCC_SPEC "%{!shared:%{!symbolic:-lgcc}}"
10550397Sobrien
10650397Sobrien/* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
10750397Sobrien   magical crtend.o file (see crtstuff.c) which provides part of the
10850397Sobrien   support for getting C++ file-scope static object constructed before
10950397Sobrien   entering `main', followed by the normal svr3/svr4 "finalizer" file,
11050397Sobrien   which is either `gcrtn.o' or `crtn.o'.  */
11150397Sobrien
11250397Sobrien#undef  ENDFILE_SPEC
11350397Sobrien#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:crtn.o%s}"
11450397Sobrien
11550397Sobrien/* Provide a LINK_SPEC appropriate for svr4.  Here we provide support
11650397Sobrien   for the special GCC options -static, -shared, and -symbolic which
11750397Sobrien   allow us to link things in one of these three modes by applying the
11850397Sobrien   appropriate combinations of options at link-time.  We also provide
11950397Sobrien   support here for as many of the other svr4 linker options as seems
12050397Sobrien   reasonable, given that some of them conflict with options for other
12150397Sobrien   svr4 tools (e.g. the assembler).  In particular, we do support the
12250397Sobrien   -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*,
12350397Sobrien   -l*, -o*, -r, -s, -u*, and -L* options are directly supported
12450397Sobrien   by gcc.c itself.  We don't directly support the -m (generate load
12550397Sobrien   map) option because that conflicts with the -m (run m4) option of
12650397Sobrien   the svr4 assembler.  We also don't directly support the svr4 linker's
12750397Sobrien   -I* or -M* options because these conflict with existing GCC options.
12850397Sobrien   We do however allow passing arbitrary options to the svr4 linker
12950397Sobrien   via the -Wl, option.  We don't support the svr4 linker's -a option
13050397Sobrien   at all because it is totally useless and because it conflicts with
13150397Sobrien   GCC's own -a option.
13250397Sobrien
13350397Sobrien   Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
13450397Sobrien
13550397Sobrien   When the -G link option is used (-shared and -symbolic) a final link is
13650397Sobrien   not being done.  */
13750397Sobrien
13850397Sobrien#undef	LINK_SPEC
13950397Sobrien#define LINK_SPEC "%{h*} %{v:-V} \
140169689Skan		   %{b} \
14150397Sobrien		   %{static:-dn -Bstatic} \
14250397Sobrien		   %{shared:-G -dy -z text} \
14350397Sobrien		   %{symbolic:-Bsymbolic -G -dy -z text} \
14450397Sobrien		   %{G:-G} \
14550397Sobrien		   %{YP,*} \
14650397Sobrien		   %{!YP,*:%{p:-Y P,/lib/libp:/usr/lib/libp:/lib:/usr/lib} \
14750397Sobrien		    %{!p:-Y P,/lib:/usr/lib}} \
14850397Sobrien		   %{Qy:} %{!Qn:-Qy}"
14950397Sobrien
150117395Skan/* Gcc automatically adds in one of the files /lib/values-Xc.o
151117395Skan   or /lib/values-Xa.o, for each final link step (depending upon the other
152117395Skan   gcc options selected, such as -ansi).  These files each contain one
153117395Skan   (initialized) copy of a special variable called `_lib_version'.  Each
154117395Skan   one of these files has `_lib_version' initialized to a different (enum)
155117395Skan   value.  The SVR4 library routines query the value of `_lib_version'
156117395Skan   at run to decide how they should behave.  Specifically, they decide
157117395Skan   (based upon the value of `_lib_version') if they will act in a strictly
158117395Skan   ANSI conforming manner or not.
15950397Sobrien*/
16050397Sobrien
16150397Sobrien#undef	STARTFILE_SPEC
16250397Sobrien#define STARTFILE_SPEC "%{!shared: \
16350397Sobrien			 %{!symbolic: \
16450397Sobrien			  %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
16550397Sobrien			%{pg:gcrti.o%s}%{!pg:crti.o%s} \
16650397Sobrien			%{ansi:values-Xc.o%s} \
167117395Skan			%{!ansi:values-Xa.o%s} \
16850397Sobrien 			crtbegin.o%s"
16950397Sobrien
170117395Skan/* Don't use bcopy, which doesn't handle overlaps before DYNIX/ptx 4.6.  */
17150397Sobrien
17290075Sobrien#undef HAVE_BCOPY
17350397Sobrien
17450397Sobrien/* The numbers used to denote specific machine registers in the System V
17550397Sobrien   Release 4 DWARF debugging information are quite likely to be totally
17650397Sobrien   different from the numbers used in BSD stabs debugging information
17750397Sobrien   for the same kind of target machine.  Thus, we undefine the macro
17850397Sobrien   DBX_REGISTER_NUMBER here as an extra inducement to get people to
17950397Sobrien   provide proper machine-specific definitions of DBX_REGISTER_NUMBER
18050397Sobrien   (which is also used to provide DWARF registers numbers in dwarfout.c)
18150397Sobrien   in their tm.h files which include this file.  */
18250397Sobrien
18350397Sobrien#undef DBX_REGISTER_NUMBER
18450397Sobrien
18550397Sobrien/* Like block addresses, stabs line numbers are relative to the
18650397Sobrien   current function.  */
18750397Sobrien
188169689Skan#define DBX_LINES_FUNCTION_RELATIVE 1
18950397Sobrien
19050397Sobrien/* Generate a blank trailing N_SO to mark the end of the .o file, since
19150397Sobrien   we can't depend upon the linker to mark .o file boundaries with
19250397Sobrien   embedded stabs.  */
19350397Sobrien
194169689Skan#define DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
19550397Sobrien
19650397Sobrien/* Define the actual types of some ANSI-mandated types.  (These
19750397Sobrien   definitions should work for most SVR4 systems).  */
19850397Sobrien
19950397Sobrien#undef SIZE_TYPE
20050397Sobrien#define SIZE_TYPE "unsigned int"
20150397Sobrien
20250397Sobrien#undef PTRDIFF_TYPE
20350397Sobrien#define PTRDIFF_TYPE "int"
20450397Sobrien
20550397Sobrien#undef WCHAR_TYPE
20650397Sobrien#define WCHAR_TYPE "long int"
20750397Sobrien
20850397Sobrien#undef WCHAR_TYPE_SIZE
20950397Sobrien#define WCHAR_TYPE_SIZE BITS_PER_WORD
21050397Sobrien
21190075Sobrien/* This says how to output assembler code to declare an uninitialized
21290075Sobrien   external linkage data item.  There's a bug in the DYNIX/ptx linker
21390075Sobrien   (PR 254649) when the alignment for such an object is specified, so
214117395Skan   ignore the ALIGN parameter.  */
21550397Sobrien
21650397Sobrien#undef ASM_OUTPUT_ALIGNED_COMMON
21750397Sobrien#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
21850397Sobriendo {									\
21990075Sobrien  fprintf ((FILE), "%s", COMMON_ASM_OP);				\
22050397Sobrien  assemble_name ((FILE), (NAME));					\
221132718Skan  fprintf ((FILE), ",%lu\n", (unsigned long)(SIZE)); \
22250397Sobrien} while (0)
223132718Skan
224