118334Speter/* Operating system specific defines to be used when targeting GCC for some 218334Speter generic System V Release 4 system. 390075Sobrien Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 490075Sobrien 2000, 2001 Free Software Foundation, Inc. 550397Sobrien Contributed by Ron Guilmette (rfg@monkeys.com). 618334Speter 7132718SkanThis file is part of GCC. 818334Speter 9132718SkanGCC is free software; you can redistribute it and/or modify 1018334Speterit under the terms of the GNU General Public License as published by 1118334Speterthe Free Software Foundation; either version 2, or (at your option) 1218334Speterany later version. 1318334Speter 14132718SkanGCC is distributed in the hope that it will be useful, 1518334Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of 1618334SpeterMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1718334SpeterGNU General Public License for more details. 1818334Speter 1918334SpeterYou should have received a copy of the GNU General Public License 20132718Skanalong with GCC; see the file COPYING. If not, write to 21169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 22169689SkanBoston, MA 02110-1301, USA. 2318334Speter 2490075Sobrien To use this file, make up a line like that in config.gcc: 2518334Speter 2690075Sobrien tm_file="$tm_file elfos.h svr4.h MACHINE/svr4.h" 2718334Speter 2890075Sobrien where MACHINE is replaced by the name of the basic hardware that you 2990075Sobrien are targeting for. Then, in the file MACHINE/svr4.h, put any really 3090075Sobrien system-specific defines (or overrides of defines) which you find that 31132718Skan you need. 3218334Speter*/ 3318334Speter 3418334Speter/* Define a symbol indicating that we are using svr4.h. */ 3518334Speter#define USING_SVR4_H 3618334Speter 3718334Speter/* Cpp, assembler, linker, library, and startfile spec's. */ 3818334Speter 3918334Speter/* This defines which switch letters take arguments. On svr4, most of 4018334Speter the normal cases (defined in gcc.c) apply, and we also have -h* and 4118334Speter -z* options (for the linker). Note however that there is no such 4218334Speter thing as a -T option for svr4. */ 4318334Speter 44132718Skan#undef SWITCH_TAKES_ARG 4590075Sobrien#define SWITCH_TAKES_ARG(CHAR) \ 4690075Sobrien (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ 4790075Sobrien || (CHAR) == 'h' \ 4890075Sobrien || (CHAR) == 'x' \ 4918334Speter || (CHAR) == 'z') 5018334Speter 5118334Speter/* This defines which multi-letter switches take arguments. On svr4, 5218334Speter there are no such switches except those implemented by GCC itself. */ 5318334Speter 5418334Speter#define WORD_SWITCH_TAKES_ARG(STR) \ 5518334Speter (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ 5618334Speter && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ 5718334Speter && strcmp (STR, "Tbss")) 5818334Speter 5918334Speter/* Provide an ASM_SPEC appropriate for svr4. Here we try to support as 6018334Speter many of the specialized svr4 assembler options as seems reasonable, 6118334Speter given that there are certain options which we can't (or shouldn't) 6250397Sobrien support directly due to the fact that they conflict with other options 6318334Speter for other svr4 tools (e.g. ld) or with other options for GCC itself. 6418334Speter For example, we don't support the -o (output file) or -R (remove 6518334Speter input file) options because GCC already handles these things. We 6618334Speter also don't support the -m (run m4) option for the assembler because 6718334Speter that conflicts with the -m (produce load map) option of the svr4 6818334Speter linker. We do however allow passing arbitrary options to the svr4 6918334Speter assembler via the -Wa, option. 7018334Speter 7118334Speter Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,* 7218334Speter option. 73132718Skan 74132718Skan The svr4 assembler wants '-' on the command line if it's expected to 75132718Skan read its stdin. 7618334Speter*/ 7718334Speter 7890075Sobrien#undef ASM_SPEC 7918334Speter#define ASM_SPEC \ 8050397Sobrien "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}" 8118334Speter 82132718Skan#define AS_NEEDS_DASH_FOR_PIPED_INPUT 8318334Speter 8418334Speter/* Under svr4, the normal location of the `ld' and `as' programs is the 8518334Speter /usr/ccs/bin directory. */ 8618334Speter 8750397Sobrien#ifndef CROSS_COMPILE 8890075Sobrien#undef MD_EXEC_PREFIX 8918334Speter#define MD_EXEC_PREFIX "/usr/ccs/bin/" 9050397Sobrien#endif 9118334Speter 9218334Speter/* Under svr4, the normal location of the various *crt*.o files is the 9318334Speter /usr/ccs/lib directory. */ 9418334Speter 9550397Sobrien#ifndef CROSS_COMPILE 9690075Sobrien#undef MD_STARTFILE_PREFIX 9718334Speter#define MD_STARTFILE_PREFIX "/usr/ccs/lib/" 9850397Sobrien#endif 9918334Speter 10018334Speter/* Provide a LIB_SPEC appropriate for svr4. Here we tack on the default 10118334Speter standard C library (unless we are building a shared library). */ 10218334Speter 10318334Speter#undef LIB_SPEC 10418334Speter#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}" 10518334Speter 10618334Speter/* Provide an ENDFILE_SPEC appropriate for svr4. Here we tack on our own 10718334Speter magical crtend.o file (see crtstuff.c) which provides part of the 10818334Speter support for getting C++ file-scope static object constructed before 10918334Speter entering `main', followed by the normal svr3/svr4 "finalizer" file, 11018334Speter which is either `gcrtn.o' or `crtn.o'. */ 11118334Speter 11218334Speter#undef ENDFILE_SPEC 11350397Sobrien#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}" 11418334Speter 11518334Speter/* Provide a LINK_SPEC appropriate for svr4. Here we provide support 11618334Speter for the special GCC options -static, -shared, and -symbolic which 11718334Speter allow us to link things in one of these three modes by applying the 11818334Speter appropriate combinations of options at link-time. We also provide 11918334Speter support here for as many of the other svr4 linker options as seems 12018334Speter reasonable, given that some of them conflict with options for other 12118334Speter svr4 tools (e.g. the assembler). In particular, we do support the 12290075Sobrien -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*, -l*, 12390075Sobrien -o*, -r, -s, -u*, and -L* options are directly supported by gcc.c 12490075Sobrien itself. We don't directly support the -m (generate load map) 12590075Sobrien option because that conflicts with the -m (run m4) option of the 12690075Sobrien svr4 assembler. We also don't directly support the svr4 linker's 12790075Sobrien -I* or -M* options because these conflict with existing GCC 12890075Sobrien options. We do however allow passing arbitrary options to the svr4 12990075Sobrien linker via the -Wl, option, in gcc.c. We don't support the svr4 13090075Sobrien linker's -a option at all because it is totally useless and because 13190075Sobrien it conflicts with GCC's own -a option. 13218334Speter 13318334Speter Note that gcc doesn't allow a space to follow -Y in a -YP,* option. 13418334Speter 13518334Speter When the -G link option is used (-shared and -symbolic) a final link is 13618334Speter not being done. */ 13718334Speter 13818334Speter#undef LINK_SPEC 13950397Sobrien#ifdef CROSS_COMPILE 14050397Sobrien#define LINK_SPEC "%{h*} %{v:-V} \ 14190075Sobrien %{b} \ 14218334Speter %{static:-dn -Bstatic} \ 14350397Sobrien %{shared:-G -dy -z text} \ 14450397Sobrien %{symbolic:-Bsymbolic -G -dy -z text} \ 14518334Speter %{G:-G} \ 14618334Speter %{YP,*} \ 14750397Sobrien %{Qy:} %{!Qn:-Qy}" 14850397Sobrien#else 14950397Sobrien#define LINK_SPEC "%{h*} %{v:-V} \ 15090075Sobrien %{b} \ 15150397Sobrien %{static:-dn -Bstatic} \ 15250397Sobrien %{shared:-G -dy -z text} \ 15350397Sobrien %{symbolic:-Bsymbolic -G -dy -z text} \ 15450397Sobrien %{G:-G} \ 15550397Sobrien %{YP,*} \ 15618334Speter %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ 15718334Speter %{!p:-Y P,/usr/ccs/lib:/usr/lib}} \ 15818334Speter %{Qy:} %{!Qn:-Qy}" 15950397Sobrien#endif 16018334Speter 161117395Skan/* Gcc automatically adds in one of the files /usr/ccs/lib/values-Xc.o 162117395Skan or /usr/ccs/lib/values-Xa.o for each final link step (depending 163117395Skan upon the other gcc options selected, such as -ansi). These files 164117395Skan each contain one (initialized) copy of a special variable called 165117395Skan `_lib_version'. Each one of these files has `_lib_version' initialized 166117395Skan to a different (enum) value. The SVR4 library routines query the 167117395Skan value of `_lib_version' at run to decide how they should behave. 168117395Skan Specifically, they decide (based upon the value of `_lib_version') 169117395Skan if they will act in a strictly ANSI conforming manner or not. */ 17018334Speter 17118334Speter#undef STARTFILE_SPEC 17218334Speter#define STARTFILE_SPEC "%{!shared: \ 17318334Speter %{!symbolic: \ 17418334Speter %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\ 17518334Speter %{pg:gcrti.o%s}%{!pg:crti.o%s} \ 17618334Speter %{ansi:values-Xc.o%s} \ 177117395Skan %{!ansi:values-Xa.o%s} \ 17818334Speter crtbegin.o%s" 17918334Speter 18018334Speter/* The numbers used to denote specific machine registers in the System V 18118334Speter Release 4 DWARF debugging information are quite likely to be totally 18218334Speter different from the numbers used in BSD stabs debugging information 18318334Speter for the same kind of target machine. Thus, we undefine the macro 18418334Speter DBX_REGISTER_NUMBER here as an extra inducement to get people to 18518334Speter provide proper machine-specific definitions of DBX_REGISTER_NUMBER 18618334Speter (which is also used to provide DWARF registers numbers in dwarfout.c) 18718334Speter in their tm.h files which include this file. */ 18818334Speter 18918334Speter#undef DBX_REGISTER_NUMBER 19018334Speter 19118334Speter/* Define the actual types of some ANSI-mandated types. (These 19218334Speter definitions should work for most SVR4 systems). */ 19318334Speter 19490075Sobrien#undef SIZE_TYPE 19518334Speter#define SIZE_TYPE "unsigned int" 19618334Speter 19790075Sobrien#undef PTRDIFF_TYPE 19818334Speter#define PTRDIFF_TYPE "int" 19918334Speter 20090075Sobrien#undef WCHAR_TYPE 20118334Speter#define WCHAR_TYPE "long int" 20218334Speter 20390075Sobrien#undef WCHAR_TYPE_SIZE 20418334Speter#define WCHAR_TYPE_SIZE BITS_PER_WORD 20518334Speter 206169689Skan#define TARGET_POSIX_IO 207