Support for official Sparc V9 ABI:
[platform/upstream/gcc.git] / gcc / config / sparc / sp64-elf.h
1 /* Definitions of target machine for GNU compiler, for SPARC64, ELF.
2    Copyright (C) 1994, 1995, 1996, 1997, 1998  Free Software Foundation, Inc.
3    Contributed by Doug Evans, dje@cygnus.com.
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 /* ??? We're taking the scheme of including another file and then overriding
23    the values we don't like a bit too far here.  The alternative is to more or
24    less duplicate all of svr4.h, sparc/sysv4.h, and sparc/sol2.h here
25    (suitably cleaned up).  */
26
27 #include "sparc/sol2.h"
28
29 #undef TARGET_VERSION
30 #define TARGET_VERSION fprintf (stderr, " (sparc64-elf)")
31
32 /* A 64 bit v9 compiler in a Medium/Anywhere code model environment.  */
33
34 #undef TARGET_DEFAULT
35 #define TARGET_DEFAULT \
36 (MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \
37  + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_STACK_BIAS)
38
39 #undef SPARC_DEFAULT_CMODEL
40 #define SPARC_DEFAULT_CMODEL CM_EMBMEDANY
41
42 #undef CPP_PREDEFINES
43 #define CPP_PREDEFINES "-Dsparc -D__ELF__ -Acpu(sparc) -Amachine(sparc)"
44
45 /* __svr4__ is used by the C library (FIXME) */
46 #undef CPP_SUBTARGET_SPEC
47 #define CPP_SUBTARGET_SPEC "-D__svr4__"
48
49 #undef MD_EXEC_PREFIX
50 #undef MD_STARTFILE_PREFIX
51
52 #undef ASM_SPEC
53 #define ASM_SPEC "\
54 %{v:-V} -s %{fpic:-K PIC} %{fPIC:-K PIC} \
55 %{mlittle-endian:-EL} \
56 %(asm_cpu) %(asm_arch) \
57 "
58
59 /* This is taken from sol2.h.  */
60 #undef LINK_SPEC
61 #define LINK_SPEC "\
62 %{v:-V} \
63 %{mlittle-endian:-EL} \
64 "
65
66 /* We need something a little simpler for the embedded environment.
67    Profiling doesn't really work yet so we just copy the default.  */
68 #undef STARTFILE_SPEC
69 #define STARTFILE_SPEC "\
70 %{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}} \
71 crtbegin.o%s \
72 "
73
74 #undef ENDFILE_SPEC
75 #define ENDFILE_SPEC "crtend.o%s"
76
77 /* Use the default (for now).  */
78 #undef LIB_SPEC
79
80 /* V9 chips can handle either endianness.  */
81 #undef SUBTARGET_SWITCHES
82 #define SUBTARGET_SWITCHES \
83 {"big-endian", -MASK_LITTLE_ENDIAN}, \
84 {"little-endian", MASK_LITTLE_ENDIAN},
85
86 #undef BYTES_BIG_ENDIAN
87 #define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
88
89 #undef WORDS_BIG_ENDIAN
90 #define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
91
92 /* ??? This should be 32 bits for v9 but what can we do?  */
93 #undef WCHAR_TYPE
94 #define WCHAR_TYPE "short unsigned int"
95
96 #undef WCHAR_TYPE_SIZE
97 #define WCHAR_TYPE_SIZE 16
98
99 #undef LONG_DOUBLE_TYPE_SIZE
100 #define LONG_DOUBLE_TYPE_SIZE 128
101
102 /* The medium/anywhere code model practically requires us to put jump tables
103    in the text section as gcc is unable to distinguish LABEL_REF's of jump
104    tables from other label refs (when we need to).  */
105 /* ??? Revisit this.  */
106 #undef JUMP_TABLES_IN_TEXT_SECTION
107 #define JUMP_TABLES_IN_TEXT_SECTION
108
109 /* System V Release 4 uses DWARF debugging info.
110    GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
111    anyway so it is the default.  */
112
113 #define DWARF_DEBUGGING_INFO
114 #define DWARF2_DEBUGGING_INFO
115 #define DBX_DEBUGGING_INFO
116
117 #undef PREFERRED_DEBUGGING_TYPE
118 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
119
120 /* Stabs doesn't use this, and it confuses a simulator.  */
121 /* ??? Need to see what DWARF needs, if anything.  */
122 #undef ASM_IDENTIFY_GCC
123 #define ASM_IDENTIFY_GCC(FILE)
124
125 /* Define the names of various pseudo-ops used by the Sparc/svr4 assembler.
126    ??? If ints are 64 bits then UNALIGNED_INT_ASM_OP (defined elsewhere) is
127    misnamed.  These should all refer to explicit sizes (half/word/xword?),
128    anything other than short/int/long/etc.  */
129
130 #define UNALIGNED_LONGLONG_ASM_OP       ".uaxword"
131
132 /* DWARF stuff.  */
133
134 #define ASM_OUTPUT_DWARF_ADDR(FILE, LABEL) \
135 do {                                                            \
136   fprintf ((FILE), "\t%s\t", UNALIGNED_LONGLONG_ASM_OP);        \
137   assemble_name ((FILE), (LABEL));                              \
138   fprintf ((FILE), "\n");                                       \
139 } while (0)
140
141 #define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, RTX) \
142 do {                                                            \
143   fprintf ((FILE), "\t%s\t", UNALIGNED_LONGLONG_ASM_OP);        \
144   output_addr_const ((FILE), (RTX));                            \
145   fputc ('\n', (FILE));                                         \
146 } while (0)
147
148 #define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE, ADDR) \
149   fprintf ((FILE), "\t%s\t%s", UNALIGNED_LONGLONG_ASM_OP, (ADDR))
150
151 /* ??? Not sure if this should be 4 or 8 bytes.  4 works for now.  */
152 #define ASM_OUTPUT_DWARF_REF(FILE, LABEL) \
153 do {                                                            \
154   fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP);             \
155   assemble_name ((FILE), (LABEL));                              \
156   fprintf ((FILE), "\n");                                       \
157 } while (0)