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).
5 This file is part of GCC.
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)
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.
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/>. */
21 #define TARGET_OBJECT_SUFFIX ".obj"
22 #define TARGET_EXECUTABLE_SUFFIX ".exe"
24 #define OBJECT_FORMAT_ELF
26 #define TARGET_OS_CPP_BUILTINS() \
28 builtin_define_std ("vms"); \
29 builtin_define_std ("VMS"); \
30 builtin_define ("__IA64"); \
31 builtin_assert ("system=vms"); \
32 builtin_define ("__IEEE_FLOAT"); \
35 /* By default, allow $ to be part of an identifier. */
36 #define DOLLARS_IN_IDENTIFIERS 2
38 #undef TARGET_ABI_OPEN_VMS
39 #define TARGET_ABI_OPEN_VMS 1
42 #define TARGET_NAME "OpenVMS/IA64"
44 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
46 /* Need .debug_line info generated from gcc and gas. */
48 #define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS)
50 #define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
52 /* "long" is 32 bits, but 64 bits for Ada. */
54 #define LONG_TYPE_SIZE 32
55 #define ADA_LONG_TYPE_SIZE 64
57 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
59 #define POINTER_SIZE 32
60 #define POINTERS_EXTEND_UNSIGNED 0
62 #undef MAX_OFILE_ALIGNMENT
63 #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
65 /* Widest floating-point type efficiently supported by hardware and OS. */
66 #undef WIDEST_HARDWARE_FP_SIZE
67 #define WIDEST_HARDWARE_FP_SIZE 64
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"
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) \
84 if ((MODE) == SImode) \
89 /* The structure return address arrives as an "argument" on VMS. */
90 #undef PCC_STATIC_STRUCT_RETURN
92 /* Turn on VMS specific Dwarf2 features. */
93 #define VMS_DEBUGGING_INFO 1
95 #define ASM_OUTPUT_DWARF_DELTA_UNITS(FILE,SIZE,LABEL1,LABEL2,UNITS) \
97 fprintf (FILE, "\tdata4.ua\t ("); \
98 assemble_name (FILE, LABEL1); \
99 fprintf (FILE, "-"); \
100 assemble_name (FILE, LABEL2); \
101 fprintf (FILE, ")/16*3"); \
104 #undef STARTFILE_SPEC
105 #define STARTFILE_SPEC \
106 "%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
108 %{!static:%{shared:crtinitS.o%s crtbeginS.o%s}}"
111 #define ENDFILE_SPEC \
112 "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
114 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
117 #define LINK_SPEC "%{g*} %{map} %{save-temps} %{shared} %{v}"
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}"
127 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
128 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
130 (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)); \
131 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function"); \
134 /* Set the function to change the names of the division and modulus
136 #undef TARGET_INIT_LIBFUNCS
137 #define TARGET_INIT_LIBFUNCS ia64_vms_init_libfuncs
139 #define NAME__MAIN "__gccmain"
140 #define SYMBOL__MAIN __gccmain
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) };
147 #undef INIT_SECTION_ASM_OP
148 #define INIT_SECTION_ASM_OP ".section\tLIB$INITIALIZE#,\"a\",@progbits"
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);
155 #undef FINI_SECTION_ASM_OP
157 /* Maybe same as HPUX? Needs to be checked. */
158 #define JMP_BUF_SIZE (8 * 76)
160 typedef struct crtl_name_spec
162 const char *const name;
163 const char *deccname;
167 #include "config/vms/vms-crtl.h"
169 /* Alias CRTL names to 32/64bit DECCRTL functions.
170 Fixme: This should do a binary search. */
171 #define DO_CRTL_NAMES \
175 static crtl_name_spec vms_crtl_names[] = CRTL_NAMES; \
176 static int malloc64_init = 0; \
178 if ((malloc64_init == 0) && TARGET_MALLOC64) \
180 for (i=0; vms_crtl_names [i].name; i++) \
182 if (strcmp ("calloc", vms_crtl_names [i].name) == 0) \
183 vms_crtl_names [i].deccname = "decc$_calloc64"; \
185 if (strcmp ("malloc", vms_crtl_names [i].name) == 0) \
186 vms_crtl_names [i].deccname = "decc$_malloc64"; \
188 if (strcmp ("realloc", vms_crtl_names [i].name) == 0) \
189 vms_crtl_names [i].deccname = "decc$_realloc64"; \
191 if (strcmp ("strdup", vms_crtl_names [i].name) == 0) \
192 vms_crtl_names [i].deccname = "decc$_strdup64"; \
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)) \
200 fprintf (file, "\t.alias %s, \"%s\"\n", \
201 name, vms_crtl_names [i].deccname); \
202 vms_crtl_names [i].referenced = 1; \
206 #undef OPTIMIZATION_OPTIONS
207 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
209 flag_merge_constants = 0; \
210 ia64_optimization_options ((LEVEL), (SIZE)); \
213 /* Define this to be nonzero if static stack checking is supported. */
214 #define STACK_CHECK_STATIC_BUILTIN 1
216 #define MD_UNWIND_SUPPORT "config/ia64/vms-unwind.h"
218 #define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
219 #define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
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)
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)
230 #undef TARGET_ASM_NAMED_SECTION
231 #define TARGET_ASM_NAMED_SECTION ia64_vms_elf_asm_named_section