1  /* Definitions of target machine GNU compiler. IA64-VMS version.
       2     Copyright (C) 2003-2023 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 OBJECT_FORMAT_ELF
      22  
      23  #define SUBTARGET_OS_CPP_BUILTINS()		\
      24      do {					\
      25  	builtin_define ("__IA64");		\
      26  	builtin_define ("__IEEE_FLOAT");	\
      27      } while (0)
      28  
      29  /* Need .debug_line info generated from gcc and gas.  */
      30  #undef TARGET_DEFAULT
      31  #define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS)
      32  
      33  #undef MAX_OFILE_ALIGNMENT
      34  #define MAX_OFILE_ALIGNMENT 524288  /* 8 x 2^16 by DEC Ada Test CD40VRA */
      35  
      36  /* Widest floating-point type efficiently supported by hardware and OS.  */
      37  #undef WIDEST_HARDWARE_FP_SIZE
      38  #define WIDEST_HARDWARE_FP_SIZE 64
      39  
      40  /* The structure return address arrives as an "argument" on VMS.  */
      41  #undef PCC_STATIC_STRUCT_RETURN
      42  
      43  /* Turn on VMS specific Dwarf2 features.  */
      44  #define VMS_DEBUGGING_INFO 1
      45  
      46  #define ASM_OUTPUT_DWARF_VMS_DELTA(FILE,SIZE,LABEL1,LABEL2) \
      47  do {                                          \
      48    fprintf (FILE, "\tdata4.ua\t@slotcount(");  \
      49    assemble_name (FILE, LABEL1);               \
      50    fprintf (FILE, "-");                        \
      51    assemble_name (FILE, LABEL2);               \
      52    fprintf (FILE, ")");                        \
      53  } while (0)
      54  
      55  #undef STARTFILE_SPEC
      56  #define STARTFILE_SPEC "%{!shared:crt0.o%s crtbegin.o%s} \
      57   %{!static:%{shared:crtinitS.o%s crtbeginS.o%s}}"
      58  
      59  #undef ENDFILE_SPEC
      60  #define ENDFILE_SPEC "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
      61  
      62  #define LINK_GCC_C_SEQUENCE_SPEC "%G"
      63  
      64  #undef LINK_SPEC
      65  #define LINK_SPEC "%{g0} %{g*:-g} %{map} %{save-temps} %{shared} %{v}"
      66  
      67  #undef LIB_SPEC
      68  #define LIB_SPEC ""
      69  
      70  #undef ASM_SPEC
      71  #define ASM_SPEC \
      72  "%{mno-gnu-as:-N so -N vms_upcase -W DVLoc_off} %{mconstant-gp:-M const_gp} \
      73   %{mauto-pic:-M no_plabel} %{source-listing:-ahdl=%b.lis}"
      74  
      75  #undef ASM_OUTPUT_EXTERNAL_LIBCALL
      76  #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)			\
      77  do {								\
      78    (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));	\
      79    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function");	\
      80  } while (0)
      81  
      82  /* Set the function to change the names of the division and modulus
      83     functions.   */
      84  #undef TARGET_INIT_LIBFUNCS
      85  #define TARGET_INIT_LIBFUNCS ia64_vms_init_libfuncs
      86  
      87  #define CTOR_LIST_BEGIN asm (".global\tLIB$INITIALIZE#\n");                  \
      88  STATIC func_ptr __CTOR_LIST__[1]                                             \
      89    __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr)))) \
      90    = { (func_ptr) (-1) };
      91  
      92  #undef INIT_SECTION_ASM_OP
      93  #define INIT_SECTION_ASM_OP ".section\tLIB$INITIALIZE#,\"a\",@progbits"
      94  
      95  #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)      \
      96    asm (SECTION_OP "\n\tdata4 @fptr(" #FUNC"#)\n");      \
      97    FORCE_CODE_SECTION_ALIGN                            \
      98    asm (TEXT_SECTION_ASM_OP);
      99  
     100  #undef FINI_SECTION_ASM_OP
     101  
     102  /* Maybe same as HPUX?  Needs to be checked.  */
     103  #define JMP_BUF_SIZE  (8 * 76)
     104  
     105  #undef SUBTARGET_OPTIMIZATION_OPTIONS
     106  #define SUBTARGET_OPTIMIZATION_OPTIONS			\
     107    { OPT_LEVELS_ALL, OPT_fmerge_constants, NULL, 0 }
     108  
     109  /* Define this to be nonzero if static stack checking is supported.  */
     110  #define STACK_CHECK_STATIC_BUILTIN 1
     111  
     112  /* Minimum amount of stack required to recover from an anticipated stack
     113     overflow detection.  The default value conveys an estimate of the amount
     114     of stack required to propagate an exception.  */
     115  #define STACK_CHECK_PROTECT (24 * 1024)
     116  
     117  #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
     118  #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
     119    ia64_vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
     120  
     121  #undef TARGET_VALID_POINTER_MODE
     122  #define TARGET_VALID_POINTER_MODE ia64_vms_valid_pointer_mode
     123  
     124  /* Define this macro if it is advisable to hold scalars in registers
     125     in a wider mode than that declared by the program.  In such cases,
     126     the value is constrained to be within the bounds of the declared
     127     type, but kept valid in the wider mode.  The signedness of the
     128     extension may differ from that of the type.
     129  
     130     For ia64, we always store objects in a full register.  32-bit integers
     131     are always sign-extended, but smaller objects retain their signedness.  */
     132  
     133  #undef PROMOTE_MODE
     134  #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE)			\
     135    if (GET_MODE_CLASS (MODE) == MODE_INT				\
     136        && GET_MODE_SIZE (MODE) < UNITS_PER_WORD)			\
     137      {								\
     138        if ((MODE) == SImode)					\
     139  	(UNSIGNEDP) = 0;					\
     140        (MODE) = DImode;						\
     141      }
     142  
     143  #undef TARGET_PROMOTE_FUNCTION_MODE
     144  #define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
     145  
     146  /* Code is always in P0/P1 (lower 32 bit addresses) on VMS.  */
     147  #undef CASE_VECTOR_MODE
     148  #define CASE_VECTOR_MODE SImode
     149  
     150  /* IA64 VMS doesn't fully support COMDAT sections.  */
     151  
     152  #define SUPPORTS_ONE_ONLY 0
     153  
     154  /* Default values for _CRTL_VER and _VMS_VER.  */
     155  #define VMS_DEFAULT_CRTL_VER 80300000
     156  #define VMS_DEFAULT_VMS_VER 80300000