1/* Operating system specific defines to be used when targeting GCC for
2   generic System V Release 3 system.
3   Copyright (C) 1991, 1996, 2000, 2002, 2004 Free Software Foundation, Inc.
4   Contributed by Ron Guilmette (rfg@monkeys.com).
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2, or (at your option)
11any later version.
12
13GCC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING.  If not, write to
20the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21Boston, MA 02110-1301, USA. */
22
23/* Define a symbol indicating that we are using svr3.h.  */
24#define USING_SVR3_H
25
26/* Define a symbol so that libgcc* can know what sort of operating
27   environment and assembler syntax we are targeting for.  */
28#define SVR3_target
29
30/* Assembler, linker, library, and startfile spec's.  */
31
32/* The .file command should always begin the output.  */
33#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
34
35/* This says how to output an assembler line
36   to define a global common symbol.  */
37/* We don't use ROUNDED because the standard compiler doesn't,
38   and the linker gives error messages if a common symbol
39   has more than one length value.  */
40
41#undef ASM_OUTPUT_COMMON
42#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
43( fputs (".comm ", (FILE)),			\
44  assemble_name ((FILE), (NAME)),		\
45  fprintf ((FILE), ",%lu\n", (unsigned long)(SIZE)))
46
47/* This says how to output an assembler line
48   to define a local common symbol.  */
49
50/* Note that using bss_section here caused errors
51   in building shared libraries on system V.3.  */
52#undef ASM_OUTPUT_LOCAL
53#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)	\
54  do {							\
55    int align = exact_log2 (ROUNDED);			\
56    if (align > 2) align = 2;				\
57    switch_to_section (data_section);			\
58    ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align);	\
59    ASM_OUTPUT_LABEL ((FILE), (NAME));			\
60    fprintf ((FILE), "\t.set .,.+%u\n", (int)(ROUNDED));	\
61  } while (0)
62
63/* Output #ident as a .ident.  */
64
65#undef  ASM_OUTPUT_IDENT
66#define ASM_OUTPUT_IDENT(FILE, NAME) \
67  fprintf (FILE, "\t.ident \"%s\"\n", NAME);
68
69/* Use periods rather than dollar signs in special g++ assembler names.  */
70
71#define NO_DOLLAR_IN_LABEL
72
73/* System V Release 3 uses COFF debugging info.  */
74
75#define SDB_DEBUGGING_INFO 1
76
77/* We don't want to output DBX debugging information.  */
78
79#undef DBX_DEBUGGING_INFO
80
81/* Define the actual types of some ANSI-mandated types.  These
82   definitions should work for most SVR3 systems.  */
83
84#undef SIZE_TYPE
85#define SIZE_TYPE "unsigned int"
86
87#undef PTRDIFF_TYPE
88#define PTRDIFF_TYPE "int"
89
90#undef WCHAR_TYPE
91#define WCHAR_TYPE "long int"
92
93#undef WCHAR_TYPE_SIZE
94#define WCHAR_TYPE_SIZE BITS_PER_WORD
95
96/* The prefix to add to user-visible assembler symbols.
97
98   For System V Release 3 the convention is to prepend a leading
99   underscore onto user-level symbol names.  */
100
101#undef USER_LABEL_PREFIX
102#define USER_LABEL_PREFIX "_"
103
104/* This is how to store into the string LABEL
105   the symbol_ref name of an internal numbered label where
106   PREFIX is the class of label and NUM is the number within the class.
107   This is suitable for output with `assemble_name'.
108
109   For most svr3 systems, the convention is that any symbol which begins
110   with a period is not put into the linker symbol table by the assembler.  */
111
112#undef ASM_GENERATE_INTERNAL_LABEL
113#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
114  sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long)(NUM))
115
116/* We want local labels to start with period if made with asm_fprintf.  */
117#undef LOCAL_LABEL_PREFIX
118#define LOCAL_LABEL_PREFIX "."
119
120/* Support const sections and the ctors and dtors sections for g++.  */
121
122/* Define a few machine-specific details of the implementation of
123   constructors.
124
125   The __CTORS_LIST__ goes in the .init section.  Define CTOR_LIST_BEGIN
126   and CTOR_LIST_END to contribute to the .init section an instruction to
127   push a word containing 0 (or some equivalent of that).
128
129   Define TARGET_ASM_CONSTRUCTOR to push the address of the constructor.  */
130
131#define INIT_SECTION_ASM_OP     "\t.section\t.init"
132#define FINI_SECTION_ASM_OP     "\t.section .fini,\"x\""
133#define DTORS_SECTION_ASM_OP    FINI_SECTION_ASM_OP
134
135/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
136   because they push on the stack.  */
137
138#ifndef STACK_GROWS_DOWNWARD
139
140/* Constructor list on stack is in reverse order.  Go to the end of the
141   list and go backwards to call constructors in the right order.  */
142#define DO_GLOBAL_CTORS_BODY					\
143do {								\
144  func_ptr *p, *beg = alloca (0);				\
145  for (p = beg; *p; p++)					\
146    ;								\
147  while (p != beg)						\
148    (*--p) ();							\
149} while (0)
150
151#else
152
153/* Constructor list on stack is in correct order.  Just call them.  */
154#define DO_GLOBAL_CTORS_BODY					\
155do {								\
156  func_ptr *p, *beg = alloca (0);				\
157  for (p = beg; *p; )						\
158    (*p++) ();							\
159} while (0)
160
161#endif /* STACK_GROWS_DOWNWARD */
162