OSDN Git Service

103cc0e42ebdb4039f4def3ae7f24668015c7646
[pf3gnuchains/gcc-fork.git] / gcc / config / ia64 / vms.h
1 /* Definitions of target machine GNU compiler. IA64-VMS version.
2    Copyright (C) 2003-2010 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 | MASK_FUSED_MADD)
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 /* The structure return address arrives as an "argument" on VMS.  */
70 #undef PCC_STATIC_STRUCT_RETURN
71
72 /* Turn on VMS specific Dwarf2 features.  */
73 #define VMS_DEBUGGING_INFO 1
74
75 #define ASM_OUTPUT_DWARF_VMS_DELTA(FILE,SIZE,LABEL1,LABEL2) \
76 do {                                          \
77   fprintf (FILE, "\tdata4.ua\t@slotcount(");  \
78   assemble_name (FILE, LABEL1);               \
79   fprintf (FILE, "-");                        \
80   assemble_name (FILE, LABEL2);               \
81   fprintf (FILE, ")");                        \
82 } while (0)
83
84 #undef STARTFILE_SPEC
85 #define STARTFILE_SPEC \
86 "%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
87     crtbegin.o%s} \
88  %{!static:%{shared:crtinitS.o%s crtbeginS.o%s}}"
89
90 #undef ENDFILE_SPEC
91 #define ENDFILE_SPEC \
92 "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
93
94 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
95
96 #undef LINK_SPEC
97 #define LINK_SPEC "%{g*} %{map} %{save-temps} %{shared} %{v}"
98
99 #undef LIB_SPEC
100 #define LIB_SPEC ""
101
102 #undef ASM_SPEC
103 #define ASM_SPEC \
104 "%{mno-gnu-as:-N so -N vms_upcase -W DVLoc_off} %{mconstant-gp:-M const_gp} \
105  %{mauto-pic:-M no_plabel} %{source-listing:-ahdl=%b.lis}"
106
107 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
108 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)                  \
109 do {                                                            \
110   (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));     \
111   ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function");  \
112 } while (0)
113
114 /* Set the function to change the names of the division and modulus
115    functions.   */
116 #undef TARGET_INIT_LIBFUNCS
117 #define TARGET_INIT_LIBFUNCS ia64_vms_init_libfuncs
118
119 #define NAME__MAIN "__gccmain"
120 #define SYMBOL__MAIN __gccmain
121
122 #define CTOR_LIST_BEGIN asm (".global\tLIB$INITIALIZE#\n");                  \
123 STATIC func_ptr __CTOR_LIST__[1]                                             \
124   __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr)))) \
125   = { (func_ptr) (-1) };
126
127 #undef INIT_SECTION_ASM_OP
128 #define INIT_SECTION_ASM_OP ".section\tLIB$INITIALIZE#,\"a\",@progbits"
129
130 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)      \
131   asm (SECTION_OP "\n\tdata4 @fptr(" #FUNC"#)\n");      \
132   FORCE_CODE_SECTION_ALIGN                            \
133   asm (TEXT_SECTION_ASM_OP);
134
135 #undef FINI_SECTION_ASM_OP
136
137 /* Maybe same as HPUX?  Needs to be checked.  */
138 #define JMP_BUF_SIZE  (8 * 76)
139
140 typedef struct crtl_name_spec
141 {
142   const char *const name;
143   const char *deccname;
144   int referenced;
145 } crtl_name_spec;
146
147 #include "config/vms/vms-crtl.h"
148
149 /* Alias CRTL names to 32/64bit DECCRTL functions.
150    Fixme: This should do a binary search.  */
151 #define DO_CRTL_NAMES                                                      \
152   do                                                                       \
153     {                                                                      \
154       int i;                                                               \
155       static crtl_name_spec vms_crtl_names[] = CRTL_NAMES;                 \
156       static int malloc64_init = 0;                                        \
157                                                                            \
158       if ((malloc64_init == 0) && TARGET_MALLOC64)                         \
159         {                                                                  \
160           for (i=0; vms_crtl_names [i].name; i++)                          \
161             {                                                              \
162               if (strcmp ("calloc", vms_crtl_names [i].name) == 0)         \
163                 vms_crtl_names [i].deccname = "decc$_calloc64";            \
164               else                                                         \
165               if (strcmp ("malloc", vms_crtl_names [i].name) == 0)         \
166                 vms_crtl_names [i].deccname = "decc$_malloc64";            \
167               else                                                         \
168               if (strcmp ("realloc", vms_crtl_names [i].name) == 0)        \
169                 vms_crtl_names [i].deccname = "decc$_realloc64";           \
170               else                                                         \
171               if (strcmp ("strdup", vms_crtl_names [i].name) == 0)         \
172                 vms_crtl_names [i].deccname = "decc$_strdup64";            \
173             }                                                              \
174             malloc64_init = 1;                                             \
175         }                                                                  \
176       for (i=0; vms_crtl_names [i].name; i++)                              \
177         if (!vms_crtl_names [i].referenced &&                              \
178             (strcmp (name, vms_crtl_names [i].name) == 0))                 \
179           {                                                                \
180             fprintf (file, "\t.alias %s, \"%s\"\n",                        \
181                      name, vms_crtl_names [i].deccname);                   \
182             vms_crtl_names [i].referenced = 1;                             \
183           }                                                                \
184     } while (0)
185
186 #undef SUBTARGET_OPTIMIZATION_OPTIONS
187 #define SUBTARGET_OPTIMIZATION_OPTIONS                     \
188   do {                                                     \
189        flag_merge_constants = 0;                           \
190   } while (0)
191
192 /* Define this to be nonzero if static stack checking is supported.  */
193 #define STACK_CHECK_STATIC_BUILTIN 1
194
195 #define MD_UNWIND_SUPPORT "config/ia64/vms-unwind.h"
196
197 #define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
198 #define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
199
200 /* Minimum amount of stack required to recover from an anticipated stack
201    overflow detection.  The default value conveys an estimate of the amount
202    of stack required to propagate an exception.  */
203 #define STACK_CHECK_PROTECT (24 * 1024)
204
205 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
206 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
207   ia64_vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
208
209 #undef TARGET_VALID_POINTER_MODE
210 #define TARGET_VALID_POINTER_MODE ia64_vms_valid_pointer_mode
211
212 #undef TARGET_ASM_NAMED_SECTION
213 #define TARGET_ASM_NAMED_SECTION ia64_vms_elf_asm_named_section