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