]>
Commit | Line | Data |
---|---|---|
8763cbe8 RS |
1 | /* Definitions of target machine for GNU compiler. |
2 | ||
3 | Citicorp/TTI Unicom PBD version | |
4 | (using GAS and COFF (encapsulated is unacceptable) ) | |
5 | ||
6 | Copyright (C) 1990 Free Software Foundation, Inc. | |
7 | ||
8 | This file is part of GNU CC. | |
9 | ||
10 | GNU CC is free software; you can redistribute it and/or modify | |
11 | it under the terms of the GNU General Public License as published by | |
12 | the Free Software Foundation; either version 2, or (at your option) | |
13 | any later version. | |
14 | ||
15 | GNU CC is distributed in the hope that it will be useful, | |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU General Public License | |
21 | along with GNU CC; see the file COPYING. If not, write to | |
22 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
23 | ||
e472c795 | 24 | #include "sparc.h" |
8763cbe8 RS |
25 | |
26 | /* Names to predefine in the preprocessor for this target machine. */ | |
27 | ||
28 | #undef CPP_PREDEFINES | |
29 | #define CPP_PREDEFINES "-Dsparc -DUnicomPBD -Dunix" | |
30 | ||
31 | /* We want DBX format for use with gdb under COFF. */ | |
32 | ||
33 | #define DBX_DEBUGGING_INFO | |
8763cbe8 RS |
34 | |
35 | /* Generate calls to memcpy, memcmp and memset. */ | |
36 | ||
37 | #define TARGET_MEM_FUNCTIONS | |
38 | ||
39 | /* we use /lib/libp/lib* when profiling */ | |
40 | ||
41 | #undef LIB_SPEC | |
0c8d4ff0 | 42 | #define LIB_SPEC "%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc" |
8763cbe8 | 43 | |
8763cbe8 | 44 | |
0c8d4ff0 RS |
45 | /* Use crt1.o as a startup file and crtn.o as a closing file. */ |
46 | /* | |
47 | * The loader directive file gcc.ifile defines how to merge the constructor | |
48 | * sections into the data section. Also, since gas only puts out those | |
49 | * sections in response to N_SETT stabs, and does not (yet) have a | |
50 | * ".sections" directive, gcc.ifile also defines the list symbols | |
51 | * __DTOR_LIST__ and __CTOR_LIST__. | |
52 | * | |
53 | * Finally, we must explicitly specify the file from libgcc.a that defines | |
54 | * exit(), otherwise if the user specifies (for example) "-lc_s" on the | |
55 | * command line, the wrong exit() will be used and global destructors will | |
56 | * not get called . | |
57 | */ | |
58 | ||
8763cbe8 | 59 | #define STARTFILE_SPEC \ |
0c8d4ff0 RS |
60 | "%{!r: gcc.ifile%s} %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} \ |
61 | %{!r:_exit.o%s}" | |
62 | ||
63 | #define ENDFILE_SPEC "crtn.o%s" | |
8763cbe8 RS |
64 | |
65 | /* cpp has to support a #sccs directive for the /usr/include files */ | |
66 | ||
67 | #define SCCS_DIRECTIVE | |
68 | ||
2296cba3 | 69 | /* LINK_SPEC is needed only for SunOS 4. */ |
0c8d4ff0 RS |
70 | |
71 | #undef LINK_SPEC | |
72 | ||
73 | /* Although the gas we use can create .ctor and .dtor sections from N_SETT | |
74 | stabs, it does not support section directives, so we need to have the loader | |
75 | define the lists. | |
76 | */ | |
77 | #define CTOR_LISTS_DEFINED_EXTERNALLY | |
78 | ||
79 | /* similar to default, but allows for the table defined by ld with gcc.ifile. | |
80 | nptrs is always 0. So we need to instead check that __DTOR_LIST__[1] != 0. | |
81 | The old check is left in so that the same macro can be used if and when | |
82 | a future version of gas does support section directives. */ | |
83 | ||
84 | #define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \ | |
85 | if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0)) \ | |
86 | for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); \ | |
87 | for (i = nptrs; i >= 1; i--) \ | |
88 | __DTOR_LIST__[i] (); } | |
89 | ||
90 | /* | |
91 | * Here is an example gcc.ifile. I've tested it on PBD sparc | |
92 | * systems. The NEXT(0x200000) works on just about all 386 and m68k systems, | |
93 | * but can be reduced to any power of 2 that is >= NBPS (0x40000 on a pbd). | |
94 | ||
95 | SECTIONS { | |
96 | .text BIND(0x41000200) BLOCK (0x200) : | |
97 | { *(.init) *(.text) vfork = fork; *(.fini) } | |
98 | ||
99 | GROUP BIND( NEXT(0x200000) + ADDR(.text) + SIZEOF(.text)): | |
100 | { .data : { __CTOR_LIST__ = . ; . += 4; *(.ctor) . += 4 ; | |
101 | __DTOR_LIST__ = . ; . += 4; *(.dtor) . += 4 ; } | |
102 | .bss : { } | |
103 | } | |
104 | } | |
105 | */ | |
106 | ||
8763cbe8 RS |
107 | #ifndef __GNUC__ |
108 | #define USE_C_ALLOCA | |
109 | #endif | |
110 | ||
111 | ||
112 | #undef ASM_OUTPUT_LABELREF | |
113 | #define ASM_OUTPUT_LABELREF(FILE,NAME) \ | |
114 | fprintf (FILE, "%s", NAME) | |
115 | ||
116 | /* fixes: */ | |
117 | /* | |
118 | * Internal labels are prefixed with a period. | |
119 | */ | |
120 | ||
121 | /* This is how to store into the string LABEL | |
122 | the symbol_ref name of an internal numbered label where | |
123 | PREFIX is the class of label and NUM is the number within the class. | |
124 | This is suitable for output with `assemble_name'. */ | |
125 | ||
126 | #undef ASM_GENERATE_INTERNAL_LABEL | |
127 | ||
128 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ | |
129 | sprintf (LABEL, "*.%s%d", PREFIX, NUM) | |
130 | ||
131 | ||
132 | /* This is how to output an internal numbered label where | |
133 | PREFIX is the class of label and NUM is the number within the class. */ | |
134 | ||
135 | #undef ASM_OUTPUT_INTERNAL_LABEL | |
136 | #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ | |
137 | fprintf (FILE, ".%s%d:\n", PREFIX, NUM) | |
138 | ||
139 | /* This is how to output an element of a case-vector that is relative. */ | |
140 | ||
141 | #undef ASM_OUTPUT_ADDR_DIFF_ELT | |
142 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ | |
143 | fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL) | |
144 | ||
145 | /* This is how to output an element of a case-vector that is absolute. | |
146 | (The 68000 does not use such vectors, | |
147 | but we must define this macro anyway.) */ | |
148 | ||
149 | #undef ASM_OUTPUT_ADDR_VEC_ELT | |
150 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
151 | fprintf (FILE, "\t.word .L%d\n", VALUE) | |
152 | ||
0c8d4ff0 RS |
153 | /* Underscores are not used on Unicom PBD coff systems. */ |
154 | /* This currently seems to only be needed for libgcc2.a */ | |
8763cbe8 RS |
155 | #define NO_UNDERSCORES |
156 | ||
157 | /* Output assembler code to FILE to increment profiler label # LABELNO | |
158 | for profiling a function entry. */ | |
159 | ||
160 | #undef FUNCTION_PROFILER | |
161 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
162 | fprintf (FILE, "\tsethi %%hi(.LP%d),%%o0\n\tcall mcount\n\tor %%lo(.LP%d),%%o0,%%o0\n", \ | |
163 | (LABELNO), (LABELNO)) | |
164 | ||
165 | /* Output assembler code to FILE to initialize this source file's | |
166 | basic block profiling info, if that has not already been done. */ | |
167 | ||
168 | #undef FUNCTION_BLOCK_PROFILER | |
169 | #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ | |
170 | fprintf (FILE, "\tsethi %%hi(.LPBX0),%%o0\n\tld [%%lo(.LPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne .LPY%d\n\tnop\n\tcall ___bb_init_func\n\tnop\n.LPY%d:\n", \ | |
171 | (LABELNO), (LABELNO)) | |
172 | ||
173 | /* Output assembler code to FILE to increment the entry-count for | |
174 | the BLOCKNO'th basic block in this source file. */ | |
175 | ||
176 | #undef BLOCK_PROFILER | |
177 | #define BLOCK_PROFILER(FILE, BLOCKNO) \ | |
178 | { \ | |
179 | int blockn = (BLOCKNO); \ | |
180 | fprintf (FILE, "\tsethi %%hi(.LPBX2+%d),%%g1\n\tld [%%lo(.LPBX2+%d)+%%g1],%%g2\n\ | |
181 | \tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(.LPBX2+%d)+%%g1]\n", \ | |
182 | 4 * blockn, 4 * blockn, 4 * blockn); \ | |
183 | CC_STATUS_INIT; /* We have clobbered %g1. Also %g2. */ \ | |
184 | } | |
185 | /* This is needed for SunOS 4.0, and should not hurt for 3.2 | |
186 | versions either. */ | |
187 | #undef ASM_OUTPUT_SOURCE_LINE(file, line) | |
188 | #define ASM_OUTPUT_SOURCE_LINE(file, line) \ | |
189 | { static int sym_lineno = 1; \ | |
190 | fprintf (file, ".stabn 68,0,%d,.LM%d\n.LM%d:\n", \ | |
191 | line, sym_lineno, sym_lineno); \ | |
192 | sym_lineno += 1; } | |
193 | ||
194 | #define ASM_INT_OP ".long " |