--- gcc/config/vms.h 2018/04/24 17:51:36 1.1 +++ gcc/config/vms.h 2018/04/24 17:59:46 1.1.1.3 @@ -32,11 +32,21 @@ the Free Software Foundation, 675 Mass A #undef TARGET_DEFAULT #undef CALL_USED_REGISTERS #undef MAYBE_VMS_FUNCTION_PROLOGUE +#undef FUNCTION_PROLOGUE +#undef STARTING_FRAME_OFFSET /* Predefine this in CPP because VMS limits the size of command options and GNU CPP is not used on VMS except with GNU C. */ -/* ??? __GNU__ is probably obsolete; delete it for 2.1. */ -#define CPP_PREDEFINES "-Dvax -Dvms -DVMS -D__GNU__ -D__GNUC__=2" +#define CPP_PREDEFINES "-Dvax -Dvms -DVMS -D__GNUC__=2" + +/* These match the definitions used in VAXCRTL, the VMS C run-time library */ + +#define SIZE_TYPE "unsigned int" +#define PTRDIFF_TYPE "int" +#define WCHAR_TYPE "unsigned int" + +/* Use memcpy for structure copying, and so forth. */ +#define TARGET_MEM_FUNCTIONS /* Strictly speaking, VMS does not use DBX at all, but the interpreter built into gas only speaks straight DBX. */ @@ -51,6 +61,26 @@ the Free Software Foundation, 675 Mass A #define CALL_USED_REGISTERS {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1} +/* We redefine this because there is a hidden variable on the stack + that VAXC$ESTABLISH uses. We just need to add four bytes to whatever + gcc thinks that we need. Similarily, we need to move all local variables + down 4 bytes in the stack. */ + +#define STARTING_FRAME_OFFSET -4 + +#define FUNCTION_PROLOGUE(FILE, SIZE) \ +{ register int regno; \ + register int mask = 0; \ + register int newsize = SIZE + 4; \ + extern char call_used_regs[]; \ + for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \ + if (regs_ever_live[regno] && !call_used_regs[regno]) \ + mask |= 1 << regno; \ + fprintf (FILE, "\t.word 0x%x\n", mask); \ + MAYBE_VMS_FUNCTION_PROLOGUE(FILE) \ + if (newsize >= 64) fprintf (FILE, "\tmovab %d(sp),sp\n", -newsize);\ + else fprintf (FILE, "\tsubl2 $%d,sp\n", newsize); } + #define __MAIN_NAME " main (" /* * The MAYBE_VMS_FUNCTION_PROLOGUE macro works for both gcc and g++. It @@ -162,7 +192,7 @@ the Free Software Foundation, 675 Mass A ? (const_section (), 0) : (data_section (), 0)), \ fputs (".comm ", (FILE)), \ assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u\n", (ROUNDED))) + fprintf ((FILE), ",%u\n", (SIZE))) /* We define this to prevent the name mangler from putting dollar signs into function names. This isn't really needed, but it has been here for @@ -172,7 +202,7 @@ the Free Software Foundation, 675 Mass A #define NO_DOLLAR_IN_LABEL -/* Add a "const" section. This is viewed by the assember as being nearly +/* Add a "const" section. This is viewed by the assembler as being nearly the same as the "data" section, with the only difference being that a flag is set for variables declared while in the const section. This flag is used to determine whether or not the read/write bit should be @@ -255,7 +285,6 @@ const_section () \ __CTOR_LIST__, and essentially points to the same list as __CTOR_LIST. */ #ifdef L__main -#include #define __CTOR_LIST__ __gxx_init_0 #define __CTOR_LIST_END__ __gxx_init_2 @@ -270,7 +299,6 @@ do { \ extern func_ptr __CTOR_LIST_END__[1]; \ extern func_ptr __CTOR_LIST_SHR__[1]; \ extern func_ptr __CTOR_LIST_SHR_END__[1]; \ - fflush(stdout); \ if( &__CTOR_LIST_SHR__[0] != &__CTOR_LIST__[1]) \ for (p = __CTOR_LIST_SHR__ + 1; p < __CTOR_LIST_SHR_END__ ; p++ ) \ if (*p) (*p) (); \