diff gcc/config/alpha/vms.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
line wrap: on
line diff
--- a/gcc/config/alpha/vms.h	Sun Aug 21 07:07:55 2011 +0900
+++ b/gcc/config/alpha/vms.h	Fri Oct 27 22:46:09 2017 +0900
@@ -1,7 +1,5 @@
 /* Output variables, constants and external declarations, for GNU compiler.
-   Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2004, 2005, 2007, 2008,
-   2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -19,13 +17,14 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#define TARGET_OBJECT_SUFFIX ".obj"
-#define TARGET_EXECUTABLE_SUFFIX ".exe"
-
 /* Alpha/VMS object format is not really Elf, but this makes compiling
    crtstuff.c and dealing with shared library initialization much easier.  */
 #define OBJECT_FORMAT_ELF
 
+/* Do not use TM clone registry as it currently doesn't work.  Alpha/VMS
+   object is too far from ELF for supporting TM out of the box.  */
+#define USE_TM_CLONE_REGISTRY 0
+
 /* This enables certain macros in alpha.h, which will make an indirect
    reference to an external symbol an invalid address.  This needs to be
    defined before we include alpha.h, since it determines which macros
@@ -33,47 +32,24 @@
 
 #define NO_EXTERNAL_INDIRECT_ADDRESS
 
-#define TARGET_OS_CPP_BUILTINS()		\
+#define SUBTARGET_OS_CPP_BUILTINS()		\
     do {					\
-	builtin_define_std ("vms");		\
-	builtin_define_std ("VMS");		\
-	builtin_define ("__ALPHA");		\
-	builtin_assert ("system=vms");		\
-	if (TARGET_FLOAT_VAX)			\
-	  builtin_define ("__G_FLOAT");		\
-	else					\
-	  builtin_define ("__IEEE_FLOAT");	\
+      builtin_define ("__ALPHA");		\
+      if (TARGET_FLOAT_VAX)			\
+        builtin_define ("__G_FLOAT");		\
+      else					\
+        builtin_define ("__IEEE_FLOAT");	\
     } while (0)
 
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_FPREGS|MASK_GAS)
-#undef TARGET_ABI_OPEN_VMS
-#define TARGET_ABI_OPEN_VMS 1
-
-#undef TARGET_NAME   
-#define TARGET_NAME "OpenVMS/Alpha"
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);           
-
-#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
-
 #undef PCC_STATIC_STRUCT_RETURN
 
-/* "long" is 32 bits, but 64 bits for Ada.  */
-#undef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE 32
-#define ADA_LONG_TYPE_SIZE 64
-
-/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended.  */
-#undef POINTER_SIZE
-#define POINTER_SIZE 32
-#define POINTERS_EXTEND_UNSIGNED 0
-
 #define MAX_OFILE_ALIGNMENT 524288  /* 8 x 2^16 by DEC Ada Test CD40VRA */
 
 /* The maximum alignment 'malloc' honors.  */
 #undef  MALLOC_ABI_ALIGNMENT
-#define MALLOC_ABI_ALIGNMENT ((TARGET_MALLOC64 ? 16 : 8) * BITS_PER_UNIT)
+#define MALLOC_ABI_ALIGNMENT \
+  ((flag_vms_malloc64 && flag_vms_pointer_size != VMS_POINTER_SIZE_NONE \
+   ? 16 : 8) * BITS_PER_UNIT)
 
 #undef FIXED_REGISTERS
 #define FIXED_REGISTERS  \
@@ -175,6 +151,13 @@
 
 #define DEFAULT_PCC_STRUCT_RETURN 0
 
+/* Even though pointers are 64bits, only 32bit ever remain significant in code
+   addresses.  */
+#define MASK_RETURN_ADDR                                \
+  (flag_vms_pointer_size == VMS_POINTER_SIZE_NONE       \
+   ? constm1_rtx                                        \
+   : GEN_INT (0xffffffff))
+
 #undef  ASM_WEAKEN_LABEL
 #define ASM_WEAKEN_LABEL(FILE, NAME)                            \
    do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME);  \
@@ -188,7 +171,6 @@
    asm (SECTION_OP "\n\t.long " #FUNC"\n");
 
 #undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) gcc_unreachable ()
 
 #undef ASM_OUTPUT_ADDR_VEC_ELT
 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
@@ -215,10 +197,6 @@
 #define TARGET_ASM_CONSTRUCTOR  vms_asm_out_constructor
 #define TARGET_ASM_DESTRUCTOR   vms_asm_out_destructor
 
-#undef SDB_DEBUGGING_INFO
-#undef MIPS_DEBUGGING_INFO
-#undef DBX_DEBUGGING_INFO
-
 #define DWARF2_DEBUGGING_INFO 1
 #define VMS_DEBUGGING_INFO 1
 
@@ -226,88 +204,44 @@
 
 #undef EH_RETURN_HANDLER_RTX
 #define EH_RETURN_HANDLER_RTX \
-  gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, 8))
+  gen_rtx_MEM (Pmode, plus_constant (Pmode, stack_pointer_rtx, 8))
 
 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
 
-#ifdef IN_LIBGCC2
-/* Get the definition for MD_FALLBACK_FRAME_STATE_FOR from a separate
-   file. This avoids having to recompile the world instead of libgcc only
-   when changes to this macro are exercised.  */
-
-#define MD_UNWIND_SUPPORT "config/alpha/vms-unwind.h"
-#endif
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-  avms_asm_output_external (FILE, DECL, NAME)
-
-typedef struct crtl_name_spec
-{
-  const char *const name;
-  const char *deccname;
-  int referenced;
-} crtl_name_spec;
-
-#include "config/vms/vms-crtl.h"
-
-/* Alias CRTL names to 32/64bit DECCRTL functions. 
-   Fixme: This should do a binary search.  */
-#define DO_CRTL_NAMES                                                      \
-  do                                                                       \
-    {                                                                      \
-      int i;                                                               \
-      static crtl_name_spec vms_crtl_names[] = CRTL_NAMES;                 \
-      static int malloc64_init = 0;                                        \
-                                                                           \
-      if ((malloc64_init == 0) && TARGET_MALLOC64)          		   \
-	{                                                                  \
-          for (i=0; vms_crtl_names [i].name; i++)                          \
-            {                                                              \
-	      if (strcmp ("calloc", vms_crtl_names [i].name) == 0)         \
-                vms_crtl_names [i].deccname = "decc$_calloc64";            \
-              else                                                         \
-	      if (strcmp ("malloc", vms_crtl_names [i].name) == 0)         \
-                vms_crtl_names [i].deccname = "decc$_malloc64";            \
-              else                                                         \
-	      if (strcmp ("realloc", vms_crtl_names [i].name) == 0)        \
-                vms_crtl_names [i].deccname = "decc$_realloc64";           \
-              else                                                         \
-	      if (strcmp ("strdup", vms_crtl_names [i].name) == 0)         \
-                vms_crtl_names [i].deccname = "decc$_strdup64";            \
-	    }                                                              \
-            malloc64_init = 1;                                             \
-        }                                                                  \
-      for (i=0; vms_crtl_names [i].name; i++)                              \
-	if (!vms_crtl_names [i].referenced &&                              \
-	    (strcmp (name, vms_crtl_names [i].name) == 0))                 \
-	  {                                                                \
-	    fprintf (file, "\t%s=%s\n",                        \
-		     name, vms_crtl_names [i].deccname);                   \
-	    vms_crtl_names [i].referenced = 1;                             \
-	  }                                                                \
-    } while (0)
-
 /* This is how to output an assembler line
    that says to advance the location counter
    to a multiple of 2**LOG bytes.  */
 
-#undef ASM_OUTPUT_ALIGN
 #define ASM_OUTPUT_ALIGN(FILE,LOG)	\
     fprintf (FILE, "\t.align %d\n", LOG);
 
+/* This is how to advance the location counter by SIZE bytes.  */
+
+#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
+  fprintf (FILE, "\t.space " HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE))
+
+/* This says how to output an assembler line
+   to define a global common symbol.  */
+
+#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED)	\
+( fputs ("\t.lcomm ", (FILE)),				\
+  assemble_name ((FILE), (NAME)),			\
+  fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)))
+
 /* Switch into a generic section.  */
 #define TARGET_ASM_NAMED_SECTION vms_asm_named_section
 
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)				\
-  do {	fprintf ((FILE), "\t.literals\n");				\
-	in_section = NULL;						\
-	fprintf ((FILE), "\t");						\
-	assemble_name (FILE, LABEL1);					\
-	fprintf (FILE, " = ");						\
-	assemble_name (FILE, LABEL2);					\
-	fprintf (FILE, "\n");						\
-  } while (0)
+#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)      \
+  do                                            \
+    {                                           \
+      fprintf ((FILE), "\t");                   \
+      assemble_name (FILE, LABEL1);             \
+      fprintf (FILE, " = ");                    \
+      assemble_name (FILE, LABEL2);             \
+      fprintf (FILE, "\n");                     \
+    }                                           \
+ while (0)
 
 #undef PREFERRED_DEBUGGING_TYPE
 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
@@ -321,7 +255,15 @@
 #undef ASM_FINAL_SPEC
 
 /* The VMS convention is to always provide minimal debug info
-   for a traceback unless specifically overridden.  */
+   for a traceback unless specifically overridden.
+
+   Because ASM_OUTPUT_ADDR_DIFF_ELT is not defined for alpha-vms,
+   jump tables cannot be output for PIC code, because you can't put
+   an absolute address in a readonly section.  Putting the table in
+   a writable section is a security hole.  Therefore, we unset the
+   flag_jump_tables flag, forcing switch statements to be expanded
+   using decision trees.  There are probably other ways to address
+   this issue, but using a decision tree is clearly safe.  */
 
 #undef SUBTARGET_OVERRIDE_OPTIONS
 #define SUBTARGET_OVERRIDE_OPTIONS                  \
@@ -332,25 +274,25 @@
       write_symbols = VMS_DEBUG;                    \
       debug_info_level = DINFO_LEVEL_TERSE;         \
     }                                               \
+  if (flag_pic)                                     \
+    flag_jump_tables = 0;                           \
 } while (0)
 
+#undef LINK_SPEC
+#if HAVE_GNU_LD
+/* GNU-ld built-in linker script already handles the dwarf2 debug sections.  */
+#define LINK_SPEC "%{shared} %{v}"
+#else
 /* Link with vms-dwarf2.o if -g (except -g0). This causes the
    VMS link to pull all the dwarf2 debug sections together.  */
-#undef LINK_SPEC
-#define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \
-%{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
+#define LINK_SPEC "%{g0} %{g*:-g vms-dwarf2.o%s} %{shared} %{v} %{map}"
+#endif
 
 #undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
-"%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
-    crtbegin.o%s} \
+#define STARTFILE_SPEC "%{!shared:crt0.o%s crtbegin.o%s} \
  %{!static:%{shared:crtbeginS.o%s}}"
 
-#define ENDFILE_SPEC \
-"%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
-
-#define NAME__MAIN "__gccmain"
-#define SYMBOL__MAIN __gccmain
+#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
 
 #define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
 
@@ -358,3 +300,7 @@
 
 #undef TARGET_VALID_POINTER_MODE
 #define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode
+
+/* Default values for _CRTL_VER and _VMS_VER.  */
+#define VMS_DEFAULT_CRTL_VER 70320000
+#define VMS_DEFAULT_VMS_VER 70320000