xref: /openbsd/gnu/usr.bin/gcc/gcc/config/sparc/pbd.h (revision c87b03e5)
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, 2000 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 
23 /* Names to predefine in the preprocessor for this target machine.  */
24 
25 #undef CPP_PREDEFINES
26 #define CPP_PREDEFINES "-Dsparc -DUnicomPBD -Dunix -D__GCC_NEW_VARARGS__ -Asystem=unix -Acpu=sparc -Amachine=sparc"
27 
28 /* We want DBX format for use with gdb under COFF.  */
29 
30 #define DBX_DEBUGGING_INFO 1
31 
32 /* Generate calls to memcpy, memcmp and memset.  */
33 
34 #define TARGET_MEM_FUNCTIONS
35 
36 /* we use /lib/libp/lib*  when profiling */
37 
38 #undef LIB_SPEC
39 #define LIB_SPEC "%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc"
40 
41 
42 /* Use crt1.o as a startup file and crtn.o as a closing file.  */
43 /*
44  * The loader directive file gcc.ifile defines how to merge the constructor
45  * sections into the data section.  Also, since gas only puts out those
46  * sections in response to N_SETT stabs, and does not (yet) have a
47  * ".sections" directive, gcc.ifile also defines the list symbols
48  * __DTOR_LIST__ and __CTOR_LIST__.
49  *
50  * Finally, we must explicitly specify the file from libgcc.a that defines
51  * exit(), otherwise if the user specifies (for example) "-lc_s" on the
52  * command line, the wrong exit() will be used and global destructors will
53  * not get called .
54  */
55 
56 #define STARTFILE_SPEC \
57 "%{!r: gcc.ifile%s} %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} \
58 %{!r:_exit.o%s}"
59 
60 #define ENDFILE_SPEC "crtn.o%s"
61 
62 /* LINK_SPEC is needed only for SunOS 4.  */
63 
64 #undef LINK_SPEC
65 
66 /* Although the gas we use can create .ctor and .dtor sections from N_SETT
67    stabs, it does not support section directives, so we need to have the loader
68    define the lists.
69    */
70 #define CTOR_LISTS_DEFINED_EXTERNALLY
71 
72 /* similar to default, but allows for the table defined by ld with gcc.ifile.
73    nptrs is always 0.  So we need to instead check that __DTOR_LIST__[1] != 0.
74    The old check is left in so that the same macro can be used if and when
75    a future version of gas does support section directives.  */
76 
77 #define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \
78   if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0))  \
79     for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); 		\
80   for (i = nptrs; i >= 1; i--)						\
81     __DTOR_LIST__[i] (); }
82 
83 /*
84  * Here is an example gcc.ifile.  I've tested it on PBD sparc
85  * systems. The NEXT(0x200000) works on just about all 386 and m68k systems,
86  * but can be reduced to any power of 2 that is >= NBPS (0x40000 on a pbd).
87 
88    SECTIONS {
89        .text BIND(0x41000200) BLOCK (0x200) :
90 		{ *(.init) *(.text) vfork = fork; *(.fini) }
91 
92       	GROUP BIND( NEXT(0x200000) + ADDR(.text) + SIZEOF(.text)):
93 	{      .data : { __CTOR_LIST__ = . ; . += 4; *(.ctor) . += 4 ;
94 		       	 __DTOR_LIST__ = . ; . += 4; *(.dtor) . += 4 ; }
95 	       .bss : { }
96        }
97   }
98  */
99 
100 /* The prefix to add to user-visible assembler symbols.  */
101 
102 #undef USER_LABEL_PREFIX
103 #define USER_LABEL_PREFIX ""
104 
105 /* fixes: */
106 /*
107  *  Internal labels are prefixed with a period.
108  */
109 
110 #undef  LOCAL_LABEL_PREFIX
111 #define LOCAL_LABEL_PREFIX  "."
112 
113 /* This is how to store into the string LABEL
114    the symbol_ref name of an internal numbered label where
115    PREFIX is the class of label and NUM is the number within the class.
116    This is suitable for output with `assemble_name'.  */
117 
118 #undef ASM_GENERATE_INTERNAL_LABEL
119 
120 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)                   \
121         sprintf (LABEL, "*.%s%ld", PREFIX, (long)(NUM))
122 
123 
124 /* This is how to output an internal numbered label where
125    PREFIX is the class of label and NUM is the number within the class.  */
126 
127 #undef  ASM_OUTPUT_INTERNAL_LABEL
128 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)                      \
129         fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
130 
131 /* This is how to output an element of a case-vector that is relative.  */
132 
133 #undef  ASM_OUTPUT_ADDR_DIFF_ELT
134 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)  \
135   fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
136 
137 /* This is how to output an element of a case-vector that is absolute.
138    (The 68000 does not use such vectors,
139    but we must define this macro anyway.)  */
140 
141 #undef ASM_OUTPUT_ADDR_VEC_ELT
142 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
143   fprintf (FILE, "\t.word .L%d\n", VALUE)
144 
145 /* This is needed for SunOS 4.0, and should not hurt for 3.2
146    versions either.  */
147 #undef ASM_OUTPUT_SOURCE_LINE
148 #define ASM_OUTPUT_SOURCE_LINE(file, line)		\
149   { static int sym_lineno = 1;				\
150     fprintf (file, ".stabn 68,0,%d,.LM%d\n.LM%d:\n",	\
151 	     line, sym_lineno, sym_lineno);		\
152     sym_lineno += 1; }
153 
154 #define ASM_INT_OP "\t.long "
155