OSDN Git Service

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