OSDN Git Service

2010-01-24 David S. Miller <davem@davemloft.net>
[pf3gnuchains/gcc-fork.git] / gcc / config / sparc / sysv4.h
1 /* Target definitions for GNU compiler for SPARC running System V.4
2    Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998, 2000, 2002, 2007, 2009,
3    2010
4    Free Software Foundation, Inc.
5    Contributed by Ron Guilmette (rfg@monkeys.com).
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3.  If not see
21 <http://www.gnu.org/licenses/>.  */
22
23 #ifndef TARGET_VERSION
24 #define TARGET_VERSION fprintf (stderr, " (sparc ELF)"); 
25 #endif
26
27 /* ??? Put back the SIZE_TYPE/PTRDIFF_TYPE definitions set by sparc.h.
28    Why, exactly, is svr4.h messing with this?  Seems like the chip 
29    would know best.  */
30
31 #undef SIZE_TYPE
32 #define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int")
33
34 #undef PTRDIFF_TYPE
35 #define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int")
36
37 /* Undefined some symbols which are defined in "svr4.h" but which are
38    appropriate only for typical svr4 systems, but not for the specific
39    case of svr4 running on a SPARC.  */
40
41 #undef INIT_SECTION_ASM_OP
42 #undef FINI_SECTION_ASM_OP
43 #undef READONLY_DATA_SECTION_ASM_OP
44 #undef TYPE_OPERAND_FMT
45 #undef PUSHSECTION_FORMAT
46 #undef STRING_ASM_OP
47 #undef COMMON_ASM_OP
48 #undef SKIP_ASM_OP
49 #undef SET_ASM_OP       /* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
50
51 /* Pass -K to the assembler when PIC.  */
52 #undef ASM_SPEC
53 #define ASM_SPEC \
54   "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
55    %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)"
56
57 /* Define the names of various pseudo-op used by the SPARC/svr4 assembler.
58    Note that many of these are different from the typical pseudo-ops used
59    by most svr4 assemblers.  That is probably due to a (misguided?) attempt
60    to keep the SPARC/svr4 assembler somewhat compatible with the SPARC/SunOS
61    assembler.  */
62
63 #define STRING_ASM_OP           "\t.asciz\t"
64 #define COMMON_ASM_OP           "\t.common\t"
65 #define SKIP_ASM_OP             "\t.skip\t"
66 #define PUSHSECTION_ASM_OP      "\t.pushsection\t"
67 #define POPSECTION_ASM_OP       "\t.popsection"
68
69 /* This is the format used to print the second operand of a .type pseudo-op
70    for the SPARC/svr4 assembler.  */
71
72 #define TYPE_OPERAND_FMT      "#%s"
73
74 /* This is the format used to print a .pushsection pseudo-op (and its operand)
75    for the SPARC/svr4 assembler.  */
76
77 #define PUSHSECTION_FORMAT      "%s\"%s\"\n"
78
79 #undef ASM_OUTPUT_CASE_LABEL
80 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)             \
81 do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3);                \
82      (*targetm.asm_out.internal_label) ((FILE), PREFIX, NUM);           \
83    } while (0)
84
85 /* This is how to equate one symbol to another symbol.  The syntax used is
86    `SYM1=SYM2'.  Note that this is different from the way equates are done
87    with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
88
89 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
90  do {   fprintf ((FILE), "\t");                                         \
91         assemble_name (FILE, LABEL1);                                   \
92         fprintf (FILE, " = ");                                          \
93         assemble_name (FILE, LABEL2);                                   \
94         fprintf (FILE, "\n");                                           \
95   } while (0)
96
97 /* A set of symbol definitions for assembly pseudo-ops which will
98    get us switched to various sections of interest.  These are used
99    in all places where we simply want to switch to a section, and
100    *not* to push the previous section name onto the assembler's
101    section names stack (as we do often in dwarfout.c).  */
102
103 #define TEXT_SECTION_ASM_OP     "\t.section\t\".text\""
104 #define DATA_SECTION_ASM_OP     "\t.section\t\".data\""
105 #define BSS_SECTION_ASM_OP      "\t.section\t\".bss\""
106 #define READONLY_DATA_SECTION_ASM_OP "\t.section\t\".rodata\""
107 #define INIT_SECTION_ASM_OP     "\t.section\t\".init\""
108 #define FINI_SECTION_ASM_OP     "\t.section\t\".fini\""
109
110 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
111  
112    Note that we want to give these sections the SHF_WRITE attribute
113    because these sections will actually contain data (i.e. tables of
114    addresses of functions in the current root executable or shared library
115    file) and, in the case of a shared library, the relocatable addresses
116    will have to be properly resolved/relocated (and then written into) by
117    the dynamic linker when it actually attaches the given shared library
118    to the executing process.  (Note that on SVR4, you may wish to use the
119    `-z text' option to the ELF linker, when building a shared library, as
120    an additional check that you are doing everything right.  But if you do
121    use the `-z text' option when building a shared library, you will get
122    errors unless the .ctors and .dtors sections are marked as writable
123    via the SHF_WRITE attribute.)  */
124  
125 #undef CTORS_SECTION_ASM_OP
126 #define CTORS_SECTION_ASM_OP    "\t.section\t\".ctors\",#alloc,#write"
127 #undef DTORS_SECTION_ASM_OP
128 #define DTORS_SECTION_ASM_OP    "\t.section\t\".dtors\",#alloc,#write"
129
130 #ifndef HAVE_GNU_AS
131 /* Switch into a generic section.  */
132 #undef TARGET_ASM_NAMED_SECTION
133 #define TARGET_ASM_NAMED_SECTION  sparc_elf_asm_named_section
134 #endif
135
136 #undef ASM_OUTPUT_ALIGNED_BSS
137 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
138   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
139
140 /* Override the name of the mcount profiling function.  */
141
142 #undef MCOUNT_FUNCTION
143 #define MCOUNT_FUNCTION "*_mcount"