OSDN Git Service

da47320999b71243890dae7616005ac8497b78f5
[pf3gnuchains/gcc-fork.git] / gcc / config / ia64 / vms.h
1 /* Definitions of target machine GNU compiler. IA64-VMS version.
2    Copyright (C) 2003-2009 Free Software Foundation, Inc.
3    Contributed by Douglas B Rupp (rupp@gnat.com).
4
5 This file is part of GCC.
6
7 GCC 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 3, or (at your option)
10 any later version.
11
12 GCC 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 GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20
21 #define TARGET_OBJECT_SUFFIX ".obj"
22 #define TARGET_EXECUTABLE_SUFFIX ".exe"
23
24 #define OBJECT_FORMAT_ELF
25
26 #define TARGET_OS_CPP_BUILTINS()                \
27     do {                                        \
28         builtin_define_std ("vms");             \
29         builtin_define_std ("VMS");             \
30         builtin_define ("__IA64");              \
31         builtin_assert ("system=vms");          \
32         builtin_define ("__IEEE_FLOAT");        \
33     } while (0)
34
35 /* By default, allow $ to be part of an identifier.  */
36 #define DOLLARS_IN_IDENTIFIERS 2
37
38 #undef TARGET_ABI_OPEN_VMS
39 #define TARGET_ABI_OPEN_VMS 1
40
41 #undef TARGET_NAME   
42 #define TARGET_NAME "OpenVMS/IA64"
43 #undef TARGET_VERSION
44 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);           
45
46 /* Need .debug_line info generated from gcc and gas.  */
47 #undef TARGET_DEFAULT
48 #define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS)
49
50 #define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
51
52 /* "long" is 32 bits, but 64 bits for Ada.  */
53 #undef LONG_TYPE_SIZE
54 #define LONG_TYPE_SIZE 32
55 #define ADA_LONG_TYPE_SIZE 64
56
57 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended.  */
58 #undef POINTER_SIZE
59 #define POINTER_SIZE 32
60 #define POINTERS_EXTEND_UNSIGNED 0
61
62 #undef MAX_OFILE_ALIGNMENT
63 #define MAX_OFILE_ALIGNMENT 524288  /* 8 x 2^16 by DEC Ada Test CD40VRA */
64
65 /* Widest floating-point type efficiently supported by hardware and OS.  */
66 #undef WIDEST_HARDWARE_FP_SIZE
67 #define WIDEST_HARDWARE_FP_SIZE 64
68
69 /* HP OpenVMS Calling Standard dated June, 2004, that describes
70    HP OpenVMS I64 Version 8.2EFT
71    chapter 4 "OpenVMS I64 Conventions"
72    section 4.7 "Procedure Linkage"
73    subsection 4.7.5.2, "Normal Register Parameters"
74
75    "Unsigned integral (except unsigned 32-bit), set, and VAX
76    floating-point values passed in registers are zero-filled;
77    signed integral values as well as unsigned 32-bit integral
78    values are sign-extended to 64 bits.  For all other types
79    passed in the general registers, unused bits are undefined."  */
80 #define PROMOTE_FUNCTION_MODE(MODE,UNSIGNEDP,TYPE)      \
81   if (GET_MODE_CLASS (MODE) == MODE_INT                 \
82       && GET_MODE_SIZE (MODE) < UNITS_PER_WORD)         \
83     {                                                   \
84       if ((MODE) == SImode)                             \
85         (UNSIGNEDP) = 0;                                \
86       (MODE) = DImode;                                  \
87     }
88
89 /* The structure return address arrives as an "argument" on VMS.  */
90 #undef PCC_STATIC_STRUCT_RETURN
91
92 /* Turn on VMS specific Dwarf2 features.  */
93 #define VMS_DEBUGGING_INFO 1
94
95 #define ASM_OUTPUT_DWARF_DELTA_UNITS(FILE,SIZE,LABEL1,LABEL2,UNITS) \
96 do {                                \
97   fprintf (FILE, "\tdata4.ua\t ("); \
98   assemble_name (FILE, LABEL1);     \
99   fprintf (FILE, "-");              \
100   assemble_name (FILE, LABEL2);     \
101   fprintf (FILE, ")/16*3");         \
102 } while (0)
103
104 #undef STARTFILE_SPEC
105 #define STARTFILE_SPEC \
106 "%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
107     crtbegin.o%s} \
108  %{!static:%{shared:crtinitS.o%s crtbeginS.o%s}}"
109
110 #undef ENDFILE_SPEC
111 #define ENDFILE_SPEC \
112 "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
113
114 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
115
116 #undef LINK_SPEC
117 #define LINK_SPEC "%{g*} %{map} %{save-temps} %{shared} %{v}"
118
119 #undef LIB_SPEC
120 #define LIB_SPEC ""
121
122 #undef ASM_SPEC
123 #define ASM_SPEC \
124 "%{mno-gnu-as:-N so -N vms_upcase -W DVLoc_off} %{mconstant-gp:-M const_gp} \
125  %{mauto-pic:-M no_plabel} %{source-listing:-ahdl=%b.lis}"
126
127 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
128 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)                  \
129 do {                                                            \
130   (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));     \
131   ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function");  \
132 } while (0)
133
134 /* Set the function to change the names of the division and modulus
135    functions.   */
136 #undef TARGET_INIT_LIBFUNCS
137 #define TARGET_INIT_LIBFUNCS ia64_vms_init_libfuncs
138
139 #define NAME__MAIN "__gccmain"
140 #define SYMBOL__MAIN __gccmain
141
142 #define CTOR_LIST_BEGIN asm (".global\tLIB$INITIALIZE#\n");                  \
143 STATIC func_ptr __CTOR_LIST__[1]                                             \
144   __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr)))) \
145   = { (func_ptr) (-1) };
146
147 #undef INIT_SECTION_ASM_OP
148 #define INIT_SECTION_ASM_OP ".section\tLIB$INITIALIZE#,\"a\",@progbits"
149
150 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)      \
151   asm (SECTION_OP "\n\tdata4 @fptr(" #FUNC"#)\n");      \
152   FORCE_CODE_SECTION_ALIGN                            \
153   asm (TEXT_SECTION_ASM_OP);
154
155 #undef FINI_SECTION_ASM_OP
156
157 /* Maybe same as HPUX?  Needs to be checked.  */
158 #define JMP_BUF_SIZE  (8 * 76)
159
160 typedef struct crtl_name_spec
161 {
162   const char *const name;
163   const char *deccname;
164   int referenced;
165 } crtl_name_spec;
166
167 #include "config/vms/vms-crtl.h"
168
169 /* Alias CRTL names to 32/64bit DECCRTL functions.
170    Fixme: This should do a binary search.  */
171 #define DO_CRTL_NAMES                                                      \
172   do                                                                       \
173     {                                                                      \
174       int i;                                                               \
175       static crtl_name_spec vms_crtl_names[] = CRTL_NAMES;                 \
176       static int malloc64_init = 0;                                        \
177                                                                            \
178       if ((malloc64_init == 0) && TARGET_MALLOC64)                         \
179         {                                                                  \
180           for (i=0; vms_crtl_names [i].name; i++)                          \
181             {                                                              \
182               if (strcmp ("calloc", vms_crtl_names [i].name) == 0)         \
183                 vms_crtl_names [i].deccname = "decc$_calloc64";            \
184               else                                                         \
185               if (strcmp ("malloc", vms_crtl_names [i].name) == 0)         \
186                 vms_crtl_names [i].deccname = "decc$_malloc64";            \
187               else                                                         \
188               if (strcmp ("realloc", vms_crtl_names [i].name) == 0)        \
189                 vms_crtl_names [i].deccname = "decc$_realloc64";           \
190               else                                                         \
191               if (strcmp ("strdup", vms_crtl_names [i].name) == 0)         \
192                 vms_crtl_names [i].deccname = "decc$_strdup64";            \
193             }                                                              \
194             malloc64_init = 1;                                             \
195         }                                                                  \
196       for (i=0; vms_crtl_names [i].name; i++)                              \
197         if (!vms_crtl_names [i].referenced &&                              \
198             (strcmp (name, vms_crtl_names [i].name) == 0))                 \
199           {                                                                \
200             fprintf (file, "\t.alias %s, \"%s\"\n",                        \
201                      name, vms_crtl_names [i].deccname);                   \
202             vms_crtl_names [i].referenced = 1;                             \
203           }                                                                \
204     } while (0)
205
206 #undef OPTIMIZATION_OPTIONS
207 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE)                   \
208   do {                                                     \
209        flag_merge_constants = 0;                           \
210        ia64_optimization_options ((LEVEL), (SIZE));        \
211   } while (0)
212
213 /* Define this to be nonzero if static stack checking is supported.  */
214 #define STACK_CHECK_STATIC_BUILTIN 1
215
216 #define MD_UNWIND_SUPPORT "config/ia64/vms-unwind.h"
217
218 #define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
219 #define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
220
221 /* Minimum amount of stack required to recover from an anticipated stack
222    overflow detection.  The default value conveys an estimate of the amount
223    of stack required to propagate an exception.  */
224 #define STACK_CHECK_PROTECT (24 * 1024)
225
226 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
227 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
228   ia64_vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
229
230 #undef TARGET_ASM_NAMED_SECTION
231 #define TARGET_ASM_NAMED_SECTION ia64_vms_elf_asm_named_section