Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / gcc / config / psos.h
1 /* Operating system specific defines to be used when targeting GCC for some
2    embedded system running pSOS. We assume GNU tools with ELF, but
3    try to maintain compatibility with the MRI tools. Based on svr4.h.
4    Copyright (C) 1996 Free Software Foundation, Inc.
5
6 This file is part of GNU CC.
7
8 GNU CC 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 2, or (at your option)
11 any later version.
12
13 GNU CC 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.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.
22
23    To use this file, make up a file with a name like:
24
25         ?????-psos.h
26
27    where ????? is replaced by the name of the basic hardware that you
28    are targeting for.  Then, in the file ?????-psos.h, put something
29    like:
30
31         #include "?????.h"
32         #include "psos.h"
33
34    followed by any really system-specific defines (or overrides of
35    defines) which you find that you need.
36 */
37
38
39 /* Define a symbol indicating that we are using psos.h.  */
40
41 #define USING_PSOS_H
42
43
44 /* All pSOS targets currently use the ELF object file format.  */
45
46 #define OBJECT_FORMAT_ELF
47
48
49 /* Provide a NULL STARTFILE_SPEC. The startfile cannot be specified
50    here because it depends on the architecture (e.g. 68K), the
51    board-support package (e.g. M162) and the run-time configuration
52    (e.g. application vs. ram-image vs. rom-image). Specify the
53    startfile in a linker-script created from the generic
54    architecture-specific linker-scripts. */
55
56 #undef  STARTFILE_SPEC
57 #define STARTFILE_SPEC ""
58
59
60 /* Predefined macros (independent of processor type). */
61
62 #define CPP_PREDEFINES "-Dpsos"
63
64
65 /* Implicit library calls should use ANSI memcpy rather than BSD
66    bcopy, etc.  */
67
68 #define TARGET_MEM_FUNCTIONS
69
70
71 /* When using stabs, gcc2_compiled must be a stabs entry, not an
72    ordinary symbol, or gdb won't see it.  The stabs entry must be
73    before the N_SO in order for gdb to find it.  */
74
75 #define ASM_IDENTIFY_GCC(FILE)                                          \
76 do                                                                      \
77   {                                                                     \
78     fputs (".stabs \"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \
79   }                                                                     \
80 while (0)
81
82 /* This is how we tell the assembler that a symbol is weak.  */
83
84 #define ASM_WEAKEN_LABEL(FILE,NAME) \
85   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
86        fputc ('\n', FILE); } while (0)
87
88 /* Switch into a generic section. */
89
90 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
91   fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
92            (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
93            (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw")
94
95
96 /* Define the pseudo-ops used to switch to the .ctors and .dtors
97    sections. */
98
99 #define CTORS_SECTION_ASM_OP    ".section\t.ctors,\"aw\""
100 #define DTORS_SECTION_ASM_OP    ".section\t.dtors,\"aw\""
101
102 /* A default list of other sections which we might be "in" at any given
103    time.  For targets that use additional sections (e.g. .tdesc) you
104    should override this definition in the target-specific file which
105    includes this file.  */
106
107 #undef EXTRA_SECTIONS
108 #define EXTRA_SECTIONS in_ctors, in_dtors
109
110 /* A default list of extra section function definitions.  For targets
111    that use additional sections (e.g. .tdesc) you should override this
112    definition in the target-specific file which includes this file.  */
113
114 #undef EXTRA_SECTION_FUNCTIONS
115 #define EXTRA_SECTION_FUNCTIONS                                         \
116   CTORS_SECTION_FUNCTION                                                \
117   DTORS_SECTION_FUNCTION
118
119 extern void text_section ();
120
121 #define CTORS_SECTION_FUNCTION                                          \
122 void                                                                    \
123 ctors_section ()                                                        \
124 {                                                                       \
125   if (in_section != in_ctors)                                           \
126     {                                                                   \
127       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
128       in_section = in_ctors;                                            \
129     }                                                                   \
130 }
131
132 #define DTORS_SECTION_FUNCTION                                          \
133 void                                                                    \
134 dtors_section ()                                                        \
135 {                                                                       \
136   if (in_section != in_dtors)                                           \
137     {                                                                   \
138       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
139       in_section = in_dtors;                                            \
140     }                                                                   \
141 }
142
143 /* A C statement (sans semicolon) to output an element in the table of
144    global constructors.  */
145
146 #ifndef INT_ASM_OP
147 #define INT_ASM_OP              ".long"
148 #endif
149 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                               \
150   do {                                                                  \
151     ctors_section ();                                                   \
152     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
153     assemble_name (FILE, NAME);                                         \
154     fprintf (FILE, "\n");                                               \
155   } while (0)
156
157 /* A C statement (sans semicolon) to output an element in the table of
158    global destructors.  */
159
160 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
161   do {                                                                  \
162     dtors_section ();                                                   \
163     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
164     assemble_name (FILE, NAME);                                         \
165     fprintf (FILE, "\n");                                               \
166   } while (0)
167
168
169 /* Use DBX debugging info by default.  */
170
171 #ifndef PREFERRED_DEBUGGING_TYPE
172 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
173 #endif
174
175 /* For pSOS we use DBX debugging info.  */
176
177 #define DBX_DEBUGGING_INFO
178
179
180 /* Prevent generation of an exit function.  */
181
182 #define HAVE_ATEXIT
183