1 |
38 |
julius |
/* Target definitions for GNU compiler for SPARC running System V.4
|
2 |
|
|
Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998, 2000, 2002, 2007
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
Contributed by Ron Guilmette (rfg@monkeys.com).
|
5 |
|
|
|
6 |
|
|
This file is part of GCC.
|
7 |
|
|
|
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.
|
12 |
|
|
|
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.
|
17 |
|
|
|
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/>. */
|
21 |
|
|
|
22 |
|
|
#ifndef TARGET_VERSION
|
23 |
|
|
#define TARGET_VERSION fprintf (stderr, " (sparc ELF)");
|
24 |
|
|
#endif
|
25 |
|
|
|
26 |
|
|
/* ??? Put back the SIZE_TYPE/PTRDIFF_TYPE definitions set by sparc.h.
|
27 |
|
|
Why, exactly, is svr4.h messing with this? Seems like the chip
|
28 |
|
|
would know best. */
|
29 |
|
|
|
30 |
|
|
#undef SIZE_TYPE
|
31 |
|
|
#define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int")
|
32 |
|
|
|
33 |
|
|
#undef PTRDIFF_TYPE
|
34 |
|
|
#define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int")
|
35 |
|
|
|
36 |
|
|
/* Undefined some symbols which are defined in "svr4.h" but which are
|
37 |
|
|
appropriate only for typical svr4 systems, but not for the specific
|
38 |
|
|
case of svr4 running on a SPARC. */
|
39 |
|
|
|
40 |
|
|
#undef INIT_SECTION_ASM_OP
|
41 |
|
|
#undef FINI_SECTION_ASM_OP
|
42 |
|
|
#undef READONLY_DATA_SECTION_ASM_OP
|
43 |
|
|
#undef TYPE_OPERAND_FMT
|
44 |
|
|
#undef PUSHSECTION_FORMAT
|
45 |
|
|
#undef STRING_ASM_OP
|
46 |
|
|
#undef COMMON_ASM_OP
|
47 |
|
|
#undef SKIP_ASM_OP
|
48 |
|
|
#undef SET_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */
|
49 |
|
|
|
50 |
|
|
/* The native assembler can't compute differences between symbols in different
|
51 |
|
|
sections when generating pic code, so we must put jump tables in the
|
52 |
|
|
text section. */
|
53 |
|
|
/* But we now defer the tables to the end of the function, so we make
|
54 |
|
|
this 0 to not confuse the branch shortening code. */
|
55 |
|
|
#define JUMP_TABLES_IN_TEXT_SECTION 0
|
56 |
|
|
|
57 |
|
|
/* Pass -K to the assembler when PIC. */
|
58 |
|
|
#undef ASM_SPEC
|
59 |
|
|
#define ASM_SPEC \
|
60 |
|
|
"%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
|
61 |
|
|
%{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)"
|
62 |
|
|
|
63 |
|
|
/* Define the names of various pseudo-op used by the SPARC/svr4 assembler.
|
64 |
|
|
Note that many of these are different from the typical pseudo-ops used
|
65 |
|
|
by most svr4 assemblers. That is probably due to a (misguided?) attempt
|
66 |
|
|
to keep the SPARC/svr4 assembler somewhat compatible with the SPARC/SunOS
|
67 |
|
|
assembler. */
|
68 |
|
|
|
69 |
|
|
#define STRING_ASM_OP "\t.asciz\t"
|
70 |
|
|
#define COMMON_ASM_OP "\t.common\t"
|
71 |
|
|
#define SKIP_ASM_OP "\t.skip\t"
|
72 |
|
|
#define PUSHSECTION_ASM_OP "\t.pushsection\t"
|
73 |
|
|
#define POPSECTION_ASM_OP "\t.popsection"
|
74 |
|
|
|
75 |
|
|
/* This is the format used to print the second operand of a .type pseudo-op
|
76 |
|
|
for the SPARC/svr4 assembler. */
|
77 |
|
|
|
78 |
|
|
#define TYPE_OPERAND_FMT "#%s"
|
79 |
|
|
|
80 |
|
|
/* This is the format used to print a .pushsection pseudo-op (and its operand)
|
81 |
|
|
for the SPARC/svr4 assembler. */
|
82 |
|
|
|
83 |
|
|
#define PUSHSECTION_FORMAT "%s\"%s\"\n"
|
84 |
|
|
|
85 |
|
|
#undef ASM_OUTPUT_CASE_LABEL
|
86 |
|
|
#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
|
87 |
|
|
do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \
|
88 |
|
|
(*targetm.asm_out.internal_label) ((FILE), PREFIX, NUM); \
|
89 |
|
|
} while (0)
|
90 |
|
|
|
91 |
|
|
/* This is how to equate one symbol to another symbol. The syntax used is
|
92 |
|
|
`SYM1=SYM2'. Note that this is different from the way equates are done
|
93 |
|
|
with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
|
94 |
|
|
|
95 |
|
|
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
|
96 |
|
|
do { fprintf ((FILE), "\t"); \
|
97 |
|
|
assemble_name (FILE, LABEL1); \
|
98 |
|
|
fprintf (FILE, " = "); \
|
99 |
|
|
assemble_name (FILE, LABEL2); \
|
100 |
|
|
fprintf (FILE, "\n"); \
|
101 |
|
|
} while (0)
|
102 |
|
|
|
103 |
|
|
/* Define how the SPARC registers should be numbered for Dwarf output.
|
104 |
|
|
The numbering provided here should be compatible with the native
|
105 |
|
|
svr4 SDB debugger in the SPARC/svr4 reference port. The numbering
|
106 |
|
|
is as follows:
|
107 |
|
|
|
108 |
|
|
Assembly name gcc internal regno Dwarf regno
|
109 |
|
|
----------------------------------------------------------
|
110 |
|
|
g0-g7 0-7 0-7
|
111 |
|
|
o0-o7 8-15 8-15
|
112 |
|
|
l0-l7 16-23 16-23
|
113 |
|
|
i0-i7 24-31 24-31
|
114 |
|
|
f0-f31 32-63 40-71
|
115 |
|
|
*/
|
116 |
|
|
|
117 |
|
|
#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 32 ? (REGNO) : (REGNO) + 8)
|
118 |
|
|
|
119 |
|
|
/* A set of symbol definitions for assembly pseudo-ops which will
|
120 |
|
|
get us switched to various sections of interest. These are used
|
121 |
|
|
in all places where we simply want to switch to a section, and
|
122 |
|
|
*not* to push the previous section name onto the assembler's
|
123 |
|
|
section names stack (as we do often in dwarfout.c). */
|
124 |
|
|
|
125 |
|
|
#define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
|
126 |
|
|
#define DATA_SECTION_ASM_OP "\t.section\t\".data\""
|
127 |
|
|
#define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
|
128 |
|
|
#define READONLY_DATA_SECTION_ASM_OP "\t.section\t\".rodata\""
|
129 |
|
|
#define INIT_SECTION_ASM_OP "\t.section\t\".init\""
|
130 |
|
|
#define FINI_SECTION_ASM_OP "\t.section\t\".fini\""
|
131 |
|
|
|
132 |
|
|
/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
|
133 |
|
|
|
134 |
|
|
Note that we want to give these sections the SHF_WRITE attribute
|
135 |
|
|
because these sections will actually contain data (i.e. tables of
|
136 |
|
|
addresses of functions in the current root executable or shared library
|
137 |
|
|
file) and, in the case of a shared library, the relocatable addresses
|
138 |
|
|
will have to be properly resolved/relocated (and then written into) by
|
139 |
|
|
the dynamic linker when it actually attaches the given shared library
|
140 |
|
|
to the executing process. (Note that on SVR4, you may wish to use the
|
141 |
|
|
`-z text' option to the ELF linker, when building a shared library, as
|
142 |
|
|
an additional check that you are doing everything right. But if you do
|
143 |
|
|
use the `-z text' option when building a shared library, you will get
|
144 |
|
|
errors unless the .ctors and .dtors sections are marked as writable
|
145 |
|
|
via the SHF_WRITE attribute.) */
|
146 |
|
|
|
147 |
|
|
#undef CTORS_SECTION_ASM_OP
|
148 |
|
|
#define CTORS_SECTION_ASM_OP "\t.section\t\".ctors\",#alloc,#write"
|
149 |
|
|
#undef DTORS_SECTION_ASM_OP
|
150 |
|
|
#define DTORS_SECTION_ASM_OP "\t.section\t\".dtors\",#alloc,#write"
|
151 |
|
|
|
152 |
|
|
/* Switch into a generic section. */
|
153 |
|
|
#undef TARGET_ASM_NAMED_SECTION
|
154 |
|
|
#define TARGET_ASM_NAMED_SECTION sparc_elf_asm_named_section
|
155 |
|
|
|
156 |
|
|
#undef ASM_OUTPUT_ALIGNED_BSS
|
157 |
|
|
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
158 |
|
|
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
|
159 |
|
|
|
160 |
|
|
/* Override the name of the mcount profiling function. */
|
161 |
|
|
|
162 |
|
|
#undef MCOUNT_FUNCTION
|
163 |
|
|
#define MCOUNT_FUNCTION "*_mcount"
|