diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/config/vms | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/config/vms')
-rw-r--r-- | gcc-4.9/gcc/config/vms/make-crtlmap.awk | 55 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/t-vms | 40 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/t-vmsnative | 34 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms-ar.c | 348 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms-c.c | 488 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms-crtlmap.map | 930 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms-f.c | 31 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms-ld.c | 968 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms-opts.h | 30 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms-protos.h | 35 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms-stdint.h | 50 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms.c | 330 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms.h | 92 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/vms.opt | 63 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/x-vms | 26 | ||||
-rw-r--r-- | gcc-4.9/gcc/config/vms/xm-vms.h | 63 |
16 files changed, 3583 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/config/vms/make-crtlmap.awk b/gcc-4.9/gcc/config/vms/make-crtlmap.awk new file mode 100644 index 000000000..79c4b43c8 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/make-crtlmap.awk @@ -0,0 +1,55 @@ +# Generate the VMS crtl map +# Copyright (C) 2011-2014 Free Software Foundation, Inc. + +BEGIN { + is_first = 1; + maxlen=1; + maxlen_name="??" + prev="" + ORS="" +} + +# Remove comment and blank lines. +/^ *#/ || /^ *$/ { + next; +} + +{ + # Handle comma + if (!is_first) + print ",\n" + else + is_first = 0; + + # Check the map is sorted + if ($0 <= prev) + { + print "Map not sorted!! (with name " $0 ")\n" + exit 1 + } + prev = $0 + + # Compute the max of the identifier len. + l=length($1) + if (l > maxlen) + { + maxlen = l + maxlen_name = $1 + } + + print "{ \"" $1 "\", " + if (NF == 1) + print "0 }" + else + { + printf "VMS_CRTL_" $2 + for (i = 3; i <= NF; i++) + printf " | VMS_CRTL_" $i + printf " }" + } +} + +END { + print "\n\n" + print "#define VMS_CRTL_MAXLEN " maxlen " /*" maxlen_name " */\n" +} diff --git a/gcc-4.9/gcc/config/vms/t-vms b/gcc-4.9/gcc/config/vms/t-vms new file mode 100644 index 000000000..a34c08369 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/t-vms @@ -0,0 +1,40 @@ +# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +LIMITS_H_TEST = false + +vms-crtlmap.h: $(srcdir)/config/vms/vms-crtlmap.map \ + $(srcdir)/config/vms/make-crtlmap.awk + $(AWK) -f $(srcdir)/config/vms/make-crtlmap.awk \ + $(srcdir)/config/vms/vms-crtlmap.map > $@ + +vms.o: $(srcdir)/config/vms/vms.c $(TREE_H) $(CONFIG_H) $(SYSTEM_H) \ + coretypes.h $(TM_P_H) vms-crtlmap.h + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $< -o $@ + +vms-c.o: $(srcdir)/config/vms/vms-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(CPPLIB_H) $(TREE_H) c-family/c-pragma.h toplev.h $(GGC_H) \ + $(TM_P_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(PREPROCESSOR_DEFINES) $< -o $@ + +vms-f.o: $(srcdir)/config/vms/vms-f.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(PREPROCESSOR_DEFINES) $< -o $@ diff --git a/gcc-4.9/gcc/config/vms/t-vmsnative b/gcc-4.9/gcc/config/vms/t-vmsnative new file mode 100644 index 000000000..41848698e --- /dev/null +++ b/gcc-4.9/gcc/config/vms/t-vmsnative @@ -0,0 +1,34 @@ +# Copyright (C) 2010-2014 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Under VMS, directory names cannot contain dots. +version:=$(shell echo $(BASEVER_c) | sed -e 's/\./_/g') + +# Wrappers around native VMS tools for ld and ar. + +vms-ld.o: $(srcdir)/config/vms/vms-ld.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) + +ld$(exeext): vms-ld.o $(LIBIBERTY) + $(CC) -o $@ vms-ld.o $(LIBIBERTY) + +vms-ar.o: $(srcdir)/config/vms/vms-ar.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) + +ar$(exeext): vms-ar.o $(LIBIBERTY) + $(CC) -o $@ vms-ar.o $(LIBIBERTY) diff --git a/gcc-4.9/gcc/config/vms/vms-ar.c b/gcc-4.9/gcc/config/vms/vms-ar.c new file mode 100644 index 000000000..594e3fcc2 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms-ar.c @@ -0,0 +1,348 @@ +/* VMS archive wrapper. + Copyright (C) 2011-2014 Free Software Foundation, Inc. + Contributed by AdaCore. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "libiberty.h" + +#define FATAL_EXIT_CODE (44 | 0x10000000) + +/* Librarian arguments. */ +static int lib_arg_max = 0; +static const char **lib_args; +static int lib_arg_index = -1; + +/* Set for r/c/x/v command. */ +static int replace_mode = 0; +static int create_mode = 0; +static int extract_mode = 0; +static int verbose_mode = 0; + +static char modecmd[32]; +static char libname[256]; + +#define TEMP_FILE "arXXXXXX" +#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1) +#define SUFFIX ".com" +#define SUFFIX_LEN (sizeof(SUFFIX) - 1) + +static char *to_host_file_spec (char *filespec); +static int is_regular_file (char *name); + +#ifdef VMS +static char new_host_filespec [255]; +static char filename_buff [256]; + +static int +translate_unix (char *name, int type) +{ + strcpy (filename_buff, name); + return 0; +} +#endif + +static char * +to_host_file_spec (char *filespec) +{ +#ifdef VMS + if (strchr (filespec, ']') || strchr (filespec, ':')) + return filespec; + else + { + strcpy (filename_buff, filespec); + decc$to_vms (filespec, translate_unix, 1, 1); + strcpy (new_host_filespec, filename_buff); + return new_host_filespec; + } +#else + return filespec; +#endif +} + +/* Check to see if the file named in NAME is a regular file, i.e. not a + directory. */ + +static int +is_regular_file (char *name) +{ + int ret; + struct stat statbuf; + + ret = stat (name, &statbuf); + return !ret && S_ISREG (statbuf.st_mode); +} + +/* Add the argument contained in STR to the list of arguments to pass to the + archiver. */ + +static void +addarg (const char *str) +{ + if (++lib_arg_index >= lib_arg_max) + { + lib_arg_max += 1000; + lib_args = XRESIZEVEC (const char *, lib_args, lib_arg_max); + } + + lib_args[lib_arg_index] = str; +} + +static void +usage (void) +{ + printf ("usage: ar -r [-cv] archive file...\n"); + printf (" ar -c [-rv] archive file...\n"); + printf (" ar -x [-v] archive [module...]\n"); +} + +int +main (int argc, char *argv[]) +{ + int i, nexti, iarg; + FILE *comfile; + int comfd; + int outlen, maxoutlen = 4000; + char temp_filename[] = TEMP_FILE SUFFIX; + char command[256]; + int status; + + if (argc < 2) + { + fprintf (stderr, "ar: no command or archive\n"); + exit (FATAL_EXIT_CODE); + } + + if (argv[1][0] != '-') + { + int arglen = strlen (argv[1]); + + /* Compatibility mode. */ + for (i = 0; i < arglen; i++) + { + if (argv[1][i] == 'r') + { + replace_mode = 1; + } + else if (argv[1][i] == 'c') + { + create_mode = 1; + } + else if (argv[1][i] == 'x') + { + extract_mode = 1; + } + else if (argv[1][i] == 'v') + { + verbose_mode = 1; + } + else + { + fprintf (stderr, "ar: unknown command '%c'\n", argv[1][i]); + exit (FATAL_EXIT_CODE); + } + } + nexti = 2; + } + else + { + /* Option mode. */ + nexti = 1; + for (i = 1; i < argc; i++) + { + if (argv[i][0] != '-') + { + nexti = i; + break; + } + else if (strcmp (argv[i], "-r") == 0) + { + replace_mode = 1; + } + else if (strcmp (argv[i], "-c") == 0) + { + create_mode = 1; + } + else if (strcmp (argv[i], "-x") == 0) + { + extract_mode = 1; + } + else if (strcmp (argv[i], "-v") == 0) + { + verbose_mode = 1; + } + else if (strcmp (argv[i], "--help") == 0) + { + usage (); + exit (EXIT_SUCCESS); + } + else + { + fprintf (stderr, "ar: unknown option %s\n", argv[i]); + exit (FATAL_EXIT_CODE); + } + } + } + + if (extract_mode) + { + do + { + char *lname = argv[nexti]; + int lnamelen; + + /* Next argument is the archive name. */ + if (is_regular_file (lname)) + { + addarg (xstrdup (to_host_file_spec (lname))); + break; + } + + /* If not found, try with .olb instead of .a. */ + lnamelen = strlen (lname); + + if (lnamelen > 2 + && strcmp (&lname [lnamelen - 2], ".a") == 0) + { + char *nlibname; + + nlibname = (char *)alloca (lnamelen + 3); + strcpy (nlibname, lname); + strcpy (&nlibname [lnamelen - 2], ".olb"); + if (is_regular_file (nlibname)) + { + addarg (xstrdup (to_host_file_spec (nlibname))); + break; + } + } + + fprintf (stderr, "ar: file '%s' doesn't exist\n", lname); + exit (FATAL_EXIT_CODE); + } while (0); + } + else + strcpy (libname, to_host_file_spec (argv[nexti])); + + nexti++; + + /* Build command mode. */ + if (replace_mode) + { + strcat (modecmd, "/replace"); + + if (!is_regular_file (libname) || !replace_mode) + { + /* Really create if the archive doesn't exist. */ + strcat (modecmd, "/create"); + } + } + else if (extract_mode) + { + if (nexti == argc) + { + /* Extract all. */ + strcat (modecmd, "/extract=(*"); + } + else + strcat (modecmd, "/extract=("); + } + + /* Add files. */ + for (i = nexti; i < argc; i++) + { + if (extract_mode) + { + /* Convert to module name (remove extension) and quote it. */ + char *module = argv[i]; + int module_len = strlen (module); + char *newarg = (char *)xmalloc (module_len + 3); + int l; + + newarg[0] = '"'; + memcpy (newarg + 1, module, module_len); + + l = 1 + module_len; + if (module_len > 4 + && strcmp (&module[module_len - 4], ".obj") == 0) + l -= 4; + + newarg[l] = '"'; + newarg[l + 1] = 0; + + addarg (newarg); + } + else + { + /* Add the filename. */ + addarg (xstrdup (to_host_file_spec (argv[i]))); + } + } + + if (extract_mode) + addarg (")"); + + /* Create the command file name. */ + strcpy (temp_filename, TEMP_FILE SUFFIX); + comfd = mkstemps (temp_filename, SUFFIX_LEN); + comfile = fdopen (comfd, "w"); + + /* Write the command file. + We need to split to command into severals ones if it is too long. */ + outlen = 0; + for (iarg = 0; iarg <= lib_arg_index; iarg++) + { + if (outlen == 0) + { + fprintf (comfile, "$ library %s %s -\n", modecmd, libname); + if (create_mode && iarg == 0) + strcpy (modecmd, "/replace"); + } + + fprintf (comfile, "%s", lib_args [iarg]); + outlen += strlen (lib_args [iarg]) + 2; + + if (outlen > maxoutlen || iarg == lib_arg_index) + { + /* Will write a new command. */ + fprintf (comfile, "\n"); + outlen = 0; + } + else + { + /* Continuation line. */ + fprintf (comfile, ",-\n"); + } + } + + fclose (comfile); + + sprintf (command, "@%s", temp_filename); + + status = system (command); + + remove (temp_filename); + + exit (status); +} diff --git a/gcc-4.9/gcc/config/vms/vms-c.c b/gcc-4.9/gcc/config/vms/vms-c.c new file mode 100644 index 000000000..6c711040f --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms-c.c @@ -0,0 +1,488 @@ +/* VMS specific, C compiler specific functions. + Copyright (C) 2011-2014 Free Software Foundation, Inc. + Contributed by Tristan Gingold (gingold@adacore.com). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "cpplib.h" +#include "tree.h" +#include "c-family/c-pragma.h" +#include "c-family/c-common.h" +#include "c/c-tree.h" +#include "toplev.h" +#include "ggc.h" +#include "tm_p.h" +#include "incpath.h" +#include "diagnostic.h" + +/* '#pragma __nostandard' is simply ignored. */ + +static void +vms_pragma_nostandard (cpp_reader *pfile ATTRIBUTE_UNUSED) +{ + tree x; + + if (pragma_lex (&x) != CPP_EOF) + warning (OPT_Wpragmas, "junk at end of #pragma __nostandard"); +} + +/* '#pragma __standard' is simply ignored. */ + +static void +vms_pragma_standard (cpp_reader *pfile ATTRIBUTE_UNUSED) +{ + tree x; + + if (pragma_lex (&x) != CPP_EOF) + warning (OPT_Wpragmas, "junk at end of #pragma __standard"); +} + +/* Saved member alignment. */ +static int saved_member_alignment; + +/* Handle '#pragma member_alignment'. */ + +static void +vms_pragma_member_alignment (cpp_reader *pfile ATTRIBUTE_UNUSED) +{ + tree x; + int tok; + const char *arg; + + tok = pragma_lex (&x); + + if (tok == CPP_EOF) + { + /* Disable packing. */ + maximum_field_alignment = initial_max_fld_align; + return; + } + if (tok != CPP_NAME) + { + warning (OPT_Wpragmas, "malformed '#pragma member_alignment', ignoring"); + return; + } + + arg = IDENTIFIER_POINTER (x); + /* Accept '__' prefix. */ + if (arg[0] == '_' && arg[1] == '_') + arg += 2; + + if (strcmp (arg, "save") == 0) + saved_member_alignment = maximum_field_alignment; + else if (strcmp (arg, "restore") == 0) + maximum_field_alignment = saved_member_alignment; + else + { + error ("unknown '#pragma member_alignment' name %s", arg); + return; + } + if (pragma_lex (&x) != CPP_EOF) + { + error ("malformed '#pragma member_alignment'"); + return; + } +} + +/* Handle '#pragma nomember_alignment'. */ + +static void +vms_pragma_nomember_alignment (cpp_reader *pfile ATTRIBUTE_UNUSED) +{ + tree x; + int tok; + + tok = pragma_lex (&x); + if (tok == CPP_NAME) + { + const char *arg = IDENTIFIER_POINTER (x); + + /* Accept '__' prefix. */ + if (arg[0] == '_' && arg[1] == '_') + arg += 2; + + if (strcmp (arg, "byte") == 0) + maximum_field_alignment = 1 * BITS_PER_UNIT; + else if (strcmp (arg, "word") == 0) + maximum_field_alignment = 2 * BITS_PER_UNIT; + else if (strcmp (arg, "longword") == 0) + maximum_field_alignment = 4 * BITS_PER_UNIT; + else if (strcmp (arg, "quadword") == 0) + maximum_field_alignment = 8 * BITS_PER_UNIT; + else if (strcmp (arg, "octaword") == 0) + maximum_field_alignment = 16 * BITS_PER_UNIT; + else + { + error ("unhandled alignment for '#pragma nomember_alignment'"); + } + + tok = pragma_lex (&x); + } + else + { + /* Enable packing. */ + maximum_field_alignment = BITS_PER_UNIT; + } + + if (tok != CPP_EOF) + { + error ("garbage at end of '#pragma nomember_alignment'"); + return; + } +} + +/* The 'extern model' for public data. This drives how the following + declarations are handled: + 1) extern int name; + 2) int name; + 3) int name = 5; + See below for the behaviour as implemented by the native compiler. +*/ + +enum extern_model_kind +{ + /* Create one overlaid section per variable. All the above declarations (1, + 2 and 3) are handled the same way: they create an overlaid section named + NAME (and initialized only for 3). No global symbol is created. + This is the VAX C behavior. */ + extern_model_common_block, + + /* Like unix: multiple not-initialized declarations are allowed. + Only one initialized definition (case 3) is allows, but multiple + uninitialize definition (case 2) are allowed. + For case 2, this creates both a section named NAME and a global symbol. + For case 3, this creates a conditional global symbol defenition and a + conditional section definition. + This is the traditional UNIX C behavior. */ + extern_model_relaxed_refdef, + + /* Like -fno-common. Only one definition (cases 2 and 3) are allowed. + This is the ANSI-C model. */ + extern_model_strict_refdef, + + /* Declarations creates symbols without storage. */ + extern_model_globalvalue +}; + +/* Current and saved extern model. */ +static enum extern_model_kind current_extern_model; +static enum extern_model_kind saved_extern_model; + +/* Partial handling of '#pragma extern_model'. */ + +static void +vms_pragma_extern_model (cpp_reader *pfile ATTRIBUTE_UNUSED) +{ + tree x; + int tok; + const char *arg; + + tok = pragma_lex (&x); + + if (tok != CPP_NAME) + { + warning (OPT_Wpragmas, "malformed '#pragma extern_model', ignoring"); + return; + } + + arg = IDENTIFIER_POINTER (x); + /* Accept "__" prefix. */ + if (arg[0] == '_' && arg[1] == '_') + arg += 2; + + if (strcmp (arg, "save") == 0) + saved_extern_model = current_extern_model; + else if (strcmp (arg, "restore") == 0) + current_extern_model = saved_extern_model; + else if (strcmp (arg, "relaxed_refdef") == 0) + current_extern_model = extern_model_relaxed_refdef; + else if (strcmp (arg, "strict_refdef") == 0) + current_extern_model = extern_model_strict_refdef; + else if (strcmp (arg, "common_block") == 0) + current_extern_model = extern_model_common_block; + else if (strcmp (arg, "globalvalue") == 0) + { + sorry ("extern model globalvalue"); + return; + } + else + { + error ("unknown '#pragma extern_model' model '%s'", arg); + return; + } +#if 0 + if (pragma_lex (&x) != CPP_EOF) + { + permerror (input_location, "junk at end of '#pragma extern_model'"); + return; + } +#endif +} + +/* Ignore '#pragma message'. */ + +static void +vms_pragma_message (cpp_reader *pfile ATTRIBUTE_UNUSED) +{ + /* Completly ignored. */ +#if 0 + pedwarn (input_location, OPT_Wpragmas, + "vms '#pragma __message' is ignored"); +#endif +} + +/* Handle '#pragma __extern_prefix' */ + +static GTY(()) tree saved_extern_prefix; + +static void +vms_pragma_extern_prefix (cpp_reader * ARG_UNUSED (dummy)) +{ + enum cpp_ttype tok; + tree x; + + tok = pragma_lex (&x); + if (tok == CPP_NAME) + { + const char *op = IDENTIFIER_POINTER (x); + + if (!strcmp (op, "__save")) + saved_extern_prefix = pragma_extern_prefix; + else if (!strcmp (op, "__restore")) + pragma_extern_prefix = saved_extern_prefix; + else + warning (OPT_Wpragmas, + "malformed '#pragma __extern_prefix', ignoring"); + return; + } + else if (tok != CPP_STRING) + { + warning (OPT_Wpragmas, + "malformed '#pragma __extern_prefix', ignoring"); + } + else + { + /* Note that the length includes the null terminator. */ + pragma_extern_prefix = (TREE_STRING_LENGTH (x) > 1 ? x : NULL); + } +} + +/* #pragma __pointer_size */ + +static enum machine_mode saved_pointer_mode; + +static void +handle_pragma_pointer_size (const char *pragma_name) +{ + enum cpp_ttype tok; + tree x; + + tok = pragma_lex (&x); + if (tok == CPP_NAME) + { + const char *op = IDENTIFIER_POINTER (x); + + if (!strcmp (op, "__save")) + saved_pointer_mode = c_default_pointer_mode; + else if (!strcmp (op, "__restore")) + c_default_pointer_mode = saved_pointer_mode; + else if (!strcmp (op, "__short")) + c_default_pointer_mode = SImode; + else if (!strcmp (op, "__long")) + c_default_pointer_mode = DImode; + else + error ("malformed %<#pragma %s%>, ignoring", pragma_name); + } + else if (tok == CPP_NUMBER) + { + int val; + + if (TREE_CODE (x) == INTEGER_CST) + val = TREE_INT_CST_LOW (x); + else + val = -1; + + if (val == 32) + c_default_pointer_mode = SImode; + else if (val == 64) + c_default_pointer_mode = DImode; + else + error ("invalid constant in %<#pragma %s%>", pragma_name); + } + else + { + error ("malformed %<#pragma %s%>, ignoring", pragma_name); + } +} + +static void +vms_pragma_pointer_size (cpp_reader * ARG_UNUSED (dummy)) +{ + /* Ignore if no -mpointer-size option. */ + if (flag_vms_pointer_size == VMS_POINTER_SIZE_NONE) + return; + + handle_pragma_pointer_size ("pointer_size"); +} + +static void +vms_pragma_required_pointer_size (cpp_reader * ARG_UNUSED (dummy)) +{ + handle_pragma_pointer_size ("required_pointer_size"); +} + +/* Add vms-specific pragma. */ + +void +vms_c_register_pragma (void) +{ + c_register_pragma (NULL, "__nostandard", vms_pragma_nostandard); + c_register_pragma (NULL, "nostandard", vms_pragma_nostandard); + c_register_pragma (NULL, "__standard", vms_pragma_standard); + c_register_pragma (NULL, "standard", vms_pragma_standard); + c_register_pragma (NULL, "__member_alignment", vms_pragma_member_alignment); + c_register_pragma (NULL, "member_alignment", vms_pragma_member_alignment); + c_register_pragma_with_expansion (NULL, "__nomember_alignment", + vms_pragma_nomember_alignment); + c_register_pragma_with_expansion (NULL, "nomember_alignment", + vms_pragma_nomember_alignment); + c_register_pragma (NULL, "__pointer_size", + vms_pragma_pointer_size); + c_register_pragma (NULL, "__required_pointer_size", + vms_pragma_required_pointer_size); + c_register_pragma (NULL, "__extern_model", vms_pragma_extern_model); + c_register_pragma (NULL, "extern_model", vms_pragma_extern_model); + c_register_pragma (NULL, "__message", vms_pragma_message); + c_register_pragma (NULL, "__extern_prefix", vms_pragma_extern_prefix); +} + +/* Canonicalize the filename (remove directory prefix, force the .h extension), + and append it to the directory to create the path, but don't + turn / into // or // into ///; // may be a namespace escape. */ + +static char * +vms_construct_include_filename (const char *fname, cpp_dir *dir) +{ + size_t dlen, flen; + char *path; + const char *fbasename = lbasename (fname); + size_t i; + + dlen = dir->len; + flen = strlen (fbasename) + 2; + path = XNEWVEC (char, dlen + 1 + flen + 1); + memcpy (path, dir->name, dlen); + if (dlen && !IS_DIR_SEPARATOR (path[dlen - 1])) + path[dlen++] = '/'; + for (i = 0; i < flen; i++) + if (fbasename[i] == '.') + break; + else + path[dlen + i] = TOLOWER (fbasename[i]); + path[dlen + i + 0] = '.'; + path[dlen + i + 1] = 'h'; + path[dlen + i + 2] = 0; + + return path; +} + +/* Standard modules list. */ +static const char * const vms_std_modules[] = { "rtldef", "starlet_c", NULL }; + +/* Find include modules in the include path. */ + +void +vms_c_register_includes (const char *sysroot, + const char *iprefix ATTRIBUTE_UNUSED, int stdinc) +{ + static const char dir_separator_str[] = { DIR_SEPARATOR, 0 }; + struct cpp_dir *dir; + + /* Add on standard include pathes. */ + if (!stdinc) + return; + + for (dir = get_added_cpp_dirs (SYSTEM); dir != NULL; dir = dir->next) + { + const char * const *lib; + for (lib = vms_std_modules; *lib != NULL; lib++) + { + char *path; + struct stat st; + + if (sysroot != NULL) + path = concat (sysroot, dir->name, dir_separator_str, *lib, NULL); + else + path = concat (dir->name, dir_separator_str, *lib, NULL); + + if (stat (path, &st) == 0 && S_ISDIR (st.st_mode)) + { + cpp_dir *p; + + p = XNEW (cpp_dir); + p->next = NULL; + p->name = path; + p->sysp = 1; + p->construct = vms_construct_include_filename; + p->user_supplied_p = 0; + add_cpp_dir_path (p, SYSTEM); + } + else + free (path); + } + } +} + +void +vms_c_common_override_options (void) +{ + /* Allow variadic functions without parameters (as declared in starlet). */ + flag_allow_parameterless_variadic_functions = TRUE; + + /* Initialize c_default_pointer_mode. */ + switch (flag_vms_pointer_size) + { + case VMS_POINTER_SIZE_NONE: + break; + case VMS_POINTER_SIZE_32: + c_default_pointer_mode = SImode; + break; + case VMS_POINTER_SIZE_64: + c_default_pointer_mode = DImode; + break; + } +} + +/* The default value for _CRTL_VER macro. */ + +int +vms_c_get_crtl_ver (void) +{ + return VMS_DEFAULT_CRTL_VER; +} + +/* The default value for _VMS_VER macro. */ + +int +vms_c_get_vms_ver (void) +{ + return VMS_DEFAULT_VMS_VER; +} diff --git a/gcc-4.9/gcc/config/vms/vms-crtlmap.map b/gcc-4.9/gcc/config/vms/vms-crtlmap.map new file mode 100644 index 000000000..e80e2afe4 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms-crtlmap.map @@ -0,0 +1,930 @@ +# Standard C names to DEC-C names map table. +# All names in the DEC-C shared image (shared library) are prefixed +# with decc$ (this is the standard vms convention for names in public +# shared libraries). This conversion is done by the compiler for all +# languages. +# +# Currently contains only a partial list, e.g. those functions use +# in GNAT and GCC. +# +# File format: +# - Empty lines are ignored. +# - Comment lines start with '#' in the first column. +# - map lines consist in an identifier optionnaly followed by at most 2 +# space-separated flags. +# Flags are described in vms.c (prefixed by VMS_CRTL_). +# +# Keep entries alpha-sorted - this is enforced by the awk script. +# +__32_getpwent +__32_getpwnam +__32_getpwuid +__32_sigaction +__32_signal +__32_ssignal +__64_getpwent +__64_getpwnam +__64_getpwuid +__64_sigaction +__64_signal +__64_ssignal +__assert +__dl__xpv +__freeaddrinfo32 +__freeaddrinfo64 +__getaddrinfo32 +__getaddrinfo64 +__getaddrinfo_compat4332 +__getaddrinfo_compat4364 +__getgrent64 +__getgrgid64 +__getgrgid_r64 +__getgrnam64 +__getgrnam_r64 +__lgamma FLOAT64 FLOATV2 +__lgammaf FLOAT32 FLOATV2 +__lgammal FLOAT64 FLOAT128 FLOATV2 +__long_gid___32_getpwnam +__long_gid___32_getpwuid +__long_gid___64_getpwnam +__long_gid___64_getpwuid +__long_gid_access +__long_gid_chmod +__long_gid_chown +__long_gid_fchmod +__long_gid_fchown +__long_gid_fstat +__long_gid_ftw +__long_gid_getegid +__long_gid_geteuid +__long_gid_getgid +__long_gid_getgroups +__long_gid_getpwnam +__long_gid_getpwnam_r 64 +__long_gid_getpwuid +__long_gid_getpwuid_r 64 +__long_gid_getuid +__long_gid_lchown +__long_gid_lstat +__long_gid_setgid +__long_gid_setuid +__long_gid_stat +__non_utc_ftw +__nw__xui +__off64_fcntl +__off64_fseeko +__off64_fstat +__off64_ftello +__off64_ftruncate +__off64_ftw +__off64_long_gid_fstat +__off64_long_gid_ftw +__off64_long_gid_lstat +__off64_long_gid_stat +__off64_lseek +__off64_lstat +__off64_mmap 64 +__off64_non_utc_ftw +__off64_pread +__off64_pwrite +__off64_stat +__off64_truncate +__off64_utc_fstat +__off64_utc_lstat +__off64_utc_stat +__pdam_wcsftime +__pdam_wcstok 64 +__posix__exit +__posix_exit +__posix_kill +__posix_long_gid_kill +__posix_system +__posix_wait +__read_rnd +__recvmsg32 BSD44 +__recvmsg64 BSD44 +__sendmsg32 BSD44 +__sendmsg64 BSD44 +__short_gid___32_getpwent +__short_gid___64_getpwent +__short_gid_getpwent +__std_fstat +__std_ftw +__std_lstat +__std_stat +__unix_geteuid +__unix_getuid +__utc_ctime +__utc_ctime_r +__utc_fstat +__utc_ftime +__utc_gmtime +__utc_gmtime_r +__utc_localtime +__utc_localtime_r +__utc_lstat +__utc_mktime +__utc_pdam_wcsftime +__utc_stat +__utc_strftime +__utc_time +__utc_utime +__utc_utimes +__utc_wcsftime +__utctz_gmtime +__utctz_gmtime_r +__utctz_localtime +__utctz_localtime_r +__vms_pclose +__vms_wait3 +__vms_wait4 +__vms_waitpid +__writev32 +__writev64 +_exit +_fstat +a64l +abort +abs +accept BSD44 +access +acos FLOAT64 DPML +acosd FLOAT64_VAXD DPML +acosdl FLOAT64_VAXD +acosh FLOAT64_VAXD DPML +acoshl FLOAT64_VAXD +acosl FLOAT64_VAXD +alarm +asctime +asctime_r +asin FLOAT64 DPML +asind FLOAT64_VAXD DPML +asindl FLOAT64_VAXD +asinh FLOAT64_VAXD DPML +asinhl FLOAT64_VAXD +asinl FLOAT64_VAXD +atan FLOAT64 DPML +atan2 FLOAT64 DPML +atan2l FLOAT64_VAXD +atand FLOAT64_VAXD DPML +atand2 FLOAT64_VAXD DPML +atand2l FLOAT64_VAXD +atandl FLOAT64_VAXD +atanh FLOAT64_VAXD DPML +atanhl FLOAT64_VAXD +atanl FLOAT64_VAXD +atexit +atof FLOAT64 +atoi +atol +atoll +atoq +basename 64 +bcmp +bcopy +bind BSD44 +box +# brk +bsd_mh GA +bsd_waddbytes +bsd_waddstr +bsearch 64 +btowc +bzero +cabs FLOAT64 FLOATV2 +cabsf FLOAT32 FLOATV2 +cabsl FLOAT64 FLOAT128 FLOATV2 +cacos DPML +cacosh DPML +calloc 64 MALLOC +calloc_opt +carg DPML +casin DPML +casinh DPML +catan DPML +catanh DPML +catclose +catgets 64 +catopen +cbrt FLOAT64_VAXD +cbrtl FLOAT64_VAXD +ccos DPML +ccosh DPML +cdiv DPML +ceil FLOAT64 DPML +ceill FLOAT64_VAXD +cexp DPML +cfree +cfree_opt +chdir +chmod +chown +clearerr +clearerr_unlocked +clock +clock_getres +clock_gettime +clock_settime +clog DPML +close +closedir +cmul DPML +cols GA +confstr +connect BSD44 +copysign FLOAT64_VAXD DPML +copysignl FLOAT64_VAXD +cos FLOAT64 DPML +cosd FLOAT64_VAXD DPML +cosdl FLOAT64_VAXD +cosh FLOAT64 DPML +coshl FLOAT64_VAXD +cosl FLOAT64_VAXD +cot FLOAT64_VAXD DPML +cotd FLOAT64_VAXD DPML +cotdl FLOAT64_VAXD +cotl FLOAT64_VAXD +cpow DPML +creat +crtl_init +crypt 64 +csin DPML +csinh DPML +csqrt DPML +ctan DPML +ctanh DPML +ctermid 64 +ctime +ctime_r +cuserid 64 +daylight GL +delete +delwin +difftime FLOAT64 +dirname 64 +div +dlclose +dlerror +dlopen +dlsym +drand48 FLOAT64 +drem DPML +dup +dup2 +ecvt FLOAT64 +encrypt +endgrent +endhostent +endnetent +endprotoent +endpwent +endservent +endwin +environ GA +erand48 FLOAT64 +erf FLOAT64_VAXD DPML +erfc FLOAT64_VAXD DPML +erfcl FLOAT64_VAXD +erfl FLOAT64_VAXD +errno GA +execl +execle +execlp +execv +execve +execvp +exit +exp FLOAT64 DPML +expl FLOAT64_VAXD +expm1 FLOAT64_VAXD DPML +expm1l FLOAT64_VAXD +fabs FLOAT64 DPML +fabsl FLOAT64_VAXD +fchmod +fchown +fclose +fcntl +fcvt FLOAT64 +fdopen +feof +feof_unlocked +ferror +ferror_unlocked +fflush +ffs +fgetc +fgetc_unlocked +fgetname 64 +fgetpos +fgets 64 +fgetwc +fgetws 64 +fileno +finite FLOAT64_VAXD DPML +finitel FLOAT64_VAXD +flockfile +floor FLOAT64 DPML +floorl FLOAT64_VAXD +fmod FLOAT64 DPML NODPML FLOATV2 +fmodf FLOAT32 NODPML FLOATV2 +fmodl FLOAT64 FLOAT128 NODPML FLOATV2 +# fnmatch # Overridden by libiberty. +fopen +fp_class FLOAT64_VAXD DPML +fp_classl FLOAT64_VAXD +fpathconf +fprintf FLOAT64 FLOAT128 +fprintf__cf FLOAT64 FLOAT128 +fputc +fputc_unlocked +fputs +fputwc +fputws +fread +free +free_opt +freeaddrinfo +freehostent +freopen +frexp FLOAT64 DPML +frexpl FLOAT64_VAXD +fscanf FLOAT64 FLOAT128 +fseek +fseeko +fsetpos +fstat +fstatvfs +fsync +ftell +ftello +ftime +ftruncate +ftrylockfile +ftw +funlockfile +fwait +fwide +fwprintf FLOAT64 FLOAT128 +fwrite +fwscanf FLOAT64 FLOAT128 +gai_strerror +gamma FLOAT64 FLOATV2 +gammaf FLOAT32 FLOATV2 +gammal FLOAT64 FLOAT128 FLOATV2 +gbsd_mvprintw +gbsd_mvscanw +gbsd_mvwprintw +gbsd_mvwscanw +gbsd_printw +gbsd_scanw +gbsd_wprintw +gbsd_wscanw +gcvt FLOAT64 64 +get_errno_addr +get_vms_errno_addr +getaddrinfo +getaddrinfo_compat43 +getc +getc_unlocked +getchar +getchar_unlocked +getclock +getcwd 64 +getdtablesize +getegid +getenv +geteuid +getgid +getgrent +getgrgid +getgrgid_r +getgrnam +getgrnam_r +getgroups +gethostaddr +gethostbyaddr BSD44 +gethostbyname BSD44 +gethostent +gethostname +getipnodebyaddr +getipnodebyname +getitimer +getlogin +getlogin_r +getname 64 +getnameinfo +getnetbyaddr +getnetbyname +getnetent +getopt 32ONLY +getpagesize +getpeername BSD44 +getpgid +getpgrp +getpid +getppid +getprotobyname +getprotobynumber +getprotoent +getpwent +getpwnam +getpwnam_r 64 +getpwuid +getpwuid_r 64 +gets 64 +getservbyname +getservbyport +getservent +getsid +getsockname BSD44 +getsockopt +gettimeofday +getuid +getw +getwc +getwchar +glob 64 +globfree 64 +gmtime +gmtime_r +gsignal +herror +hostalias +hstrerror +htonl +htons +hypot FLOAT64 DPML NODPML FLOATV2 +hypotf FLOAT32 NODPML FLOATV2 +hypotl FLOAT64 FLOAT128 NODPML FLOATV2 +iconv +iconv_close +iconv_open +if_freenameindex +if_indextoname +if_nameindex +if_nametoindex +ilogb DPML +index 64 +inet6_opt_append +inet6_opt_find +inet6_opt_finish +inet6_opt_get_val +inet6_opt_init +inet6_opt_next +inet6_opt_set_val +inet6_rth_add +inet6_rth_getaddr +inet6_rth_init +inet6_rth_reverse +inet6_rth_segments +inet6_rth_space +inet_addr +inet_aton +inet_lnaof +inet_makeaddr +inet_netof +inet_network +inet_ntoa +inet_ntop +inet_pton +initscr +initstate +ioctl +isalnum +isalpha +isapipe +isascii +isatty +iscntrl +isdigit +isgraph +islower +isnan FLOAT64_VAXD DPML +isnanl FLOAT64_VAXD +isprint +ispunct +isspace +isupper +iswalnum +iswalpha +iswcntrl +iswctype +iswdigit +iswgraph +iswlower +iswprint +iswpunct +iswspace +iswupper +iswxdigit +isxdigit +j0 FLOAT64_VAXD DPML +j0l FLOAT64_VAXD +j1 FLOAT64_VAXD DPML +j1l FLOAT64_VAXD +jn FLOAT64_VAXD DPML +jnl FLOAT64_VAXD +jrand48 +kill +l64a +l64a_r +labs +lchown +lcong48 +ldexp FLOAT64 DPML +ldexpl FLOAT64_VAXD +ldiv +lgamma FLOAT64 DPML NODPML FLOATV2 +lgammaf FLOAT32 NODPML FLOATV2 +lgammal FLOAT64 FLOAT128 NODPML FLOATV2 +lines GA +link +listen +llabs +lldiv +locale +localeconv +localtime +localtime_r +# ln -> log DPML +log FLOAT64 FLOATV2 +log10 FLOAT64 DPML +log10l FLOAT64_VAXD +log1p FLOAT64_VAXD DPML +log1pl FLOAT64_VAXD +log2 FLOAT64_VAXD DPML +log2l FLOAT64_VAXD +logb FLOAT64_VAXD DPML +logbl FLOAT64_VAXD +logf FLOAT32 FLOATV2 +logl FLOAT64 FLOAT128 FLOATV2 +longjmp +longname 64 +lrand48 +lround DPML +lseek +lstat +lwait +malloc 64 MALLOC +malloc_opt +mblen +mbrlen +mbrtowc +mbsinit +mbsrtowcs 64 +mbstowcs +mbtowc +memccpy 64 +memchr 64 +memcmp +memcpy 64 +memmove 64 +memset 64 +mkdir +mkstemp +mktemp 64 +mktime +mmap 64 +modf FLOAT64 DPML +modfl FLOAT64_VAXD +mprotect +mrand48 +msync +munmap +mvwaddstr +mvwin +nanosleep +newwin +nextafter FLOAT64_VAXD DPML +nextafterl FLOAT64_VAXD +nice +nint FLOAT64_VAXD DPML +nintl FLOAT64_VAXD +nl_langinfo +nrand48 +ntohl +ntohs +open +opendir +optarg GA 32ONLY +opterr GL 32ONLY +optind GL 32ONLY +optopt GL 32ONLY +overlay +overwrite +pathconf +pause +pclose +perror +pipe +poll +popen +# pow DPML version ??? +pow FLOAT64 FLOATV2 +powf FLOAT32 FLOATV2 +powl FLOAT64 FLOAT128 FLOATV2 +pread +printf FLOAT64 FLOAT128 +printf__cf FLOAT64 FLOAT128 +printw FLOAT64 FLOAT128 +putc +putc_unlocked +putchar +putchar_unlocked +putenv +puts +putw +putwc +putwchar +pwrite +qabs +qdiv +qsort 64 +raise +rand +rand_r +random +read +readdir +readdir_r 64 +readlink +readv 64 +realloc 64 MALLOC +realloc_opt +realpath 64 +record_read +recv +recvfrom BSD44 +recvmsg BSD44 +remainder DPML +remove +rename +rewind +rewinddir +rindex 64 +rint FLOAT64_VAXD DPML +rintl FLOAT64_VAXD +rmdir +rtl_private +# sbrk # Makes libiberty/xmalloc.c fails to build. +scalb FLOAT64_VAXD DPML +scalbl FLOAT64_VAXD +scanf FLOAT64 FLOAT128 +scanw FLOAT64 FLOAT128 +scroll +seed48 +seekdir +select +send +sendmsg BSD44 +sendto BSD44 +set_new_handler__xpxv_v +setbuf +setenv +seteuid +setgid +setgrent +sethostent +setitimer +setkey +setlocale +setnetent +setpgid +setpgrp +setprotoent +setpwent +setregid +setreuid +setservent +setsid +setsockopt +setstate +setuid +setvbuf +shm_open +shm_unlink +shutdown +sigaction +sigaddset +sigblock +sigdelset +sigemptyset +sigfillset +sighold +sigignore +sigismember +siglongjmp +sigmask +signal +signgam GL +sigpause +sigpending +sigprocmask +sigrelse +sigsetjmp +sigsetmask +sigstack +sigsuspend +sigtimedwait +sigvec +sigwait +sigwaitinfo +sin FLOAT64 DPML +sincos DPML +sincosd DPML +sind FLOAT64_VAXD DPML +sindl FLOAT64_VAXD +sinh FLOAT64 DPML +sinhcosh DPML +sinhl FLOAT64_VAXD +sinl FLOAT64_VAXD +sleep +snprintf FLOAT64 FLOAT128 +socket +socketpair +sprintf FLOAT64 FLOAT128 +sprintf__cf FLOAT64 FLOAT128 +sqrt FLOAT64 DPML +sqrtl FLOAT64_VAXD +srand +srand48 +srandom +sscanf FLOAT64 FLOAT128 +ssignal +stat +statvfs +strcasecmp +strcat 64 +strchr 64 +strcmp +strcoll +strcpy 64 +strcspn +strdup 64 MALLOC +strerror +strfmon FLOAT64 +strftime +strlen +strncasecmp +strncat 64 +strncmp +strncpy 64 +strnlen +strpbrk 64 +strptime 64 +strptime_xpg4 +strrchr 64 +strsep 64 +strspn +strstr 64 +strtod FLOAT64 64 +strtok 64 +strtok_r 64 +strtol 64 +strtoll 64 +strtoq 64 +strtoul 64 +strtoull 64 +strtouq 64 +strxfrm +subwin +swab +swprintf FLOAT64 FLOAT128 +swscanf FLOAT64 FLOAT128 +symlink +sys_errlist GA +sys_nerr GL +sysconf +system +tan FLOAT64 DPML +tand FLOAT64_VAXD DPML +tandl FLOAT64_VAXD +tanh FLOAT64 DPML +tanhl FLOAT64_VAXD +tanl FLOAT64_VAXD +telldir +tempnam +tgamma DPML +time +times +timezone GL +tmpfile +tmpnam 64 +toascii +tolower +touchwin +toupper +towctrans +towlower +towupper +trunc FLOAT64_VAXD DPML +truncate +truncl FLOAT64_VAXD +ttyname +ttyname_r +tzname GA +tzset +ualarm +umask +uname +ungetc +ungetwc +unlink +unordered FLOAT64_VAXD DPML +unorderedl FLOAT64_VAXD +unsetenv +usleep +utime +utimes +vaxc$calloc_opt +vaxc$cfree_opt +vaxc$crtl_init +vaxc$errno GA +vaxc$free_opt +vaxc$get_sdc +vaxc$malloc_opt +vaxc$realloc_opt +vfprintf FLOAT64 FLOAT128 +vfscanf FLOAT64 FLOAT128 +vfwprintf FLOAT64 FLOAT128 +vfwscanf FLOAT64 FLOAT128 +vprintf FLOAT64 FLOAT128 +vscanf FLOAT64 FLOAT128 +vsnprintf FLOAT64 FLOAT128 +vsprintf FLOAT64 FLOAT128 +vsscanf FLOAT64 FLOAT128 +vswprintf FLOAT64 FLOAT128 +vswscanf FLOAT64 FLOAT128 +vwprintf FLOAT64 FLOAT128 +vwscanf FLOAT64 FLOAT128 +waddch +waddstr +wait +wait3 +wait4 +waitpid +wclear +wclrattr +wclrtobot +wclrtoeol +wcrtomb +wcscat 64 +wcschr 64 +wcscmp +wcscoll +wcscpy 64 +wcscspn +wcsftime +wcslen +wcsncat 64 +wcsncmp +wcsncpy 64 +wcspbrk 64 +wcsrchr 64 +wcsrtombs 64 +wcsspn +wcsstr 64 +wcstod FLOAT64 64 +wcstok 64 +wcstol 64 +wcstombs +wcstoul 64 +wcswcs 64 +wcswidth +wcsxfrm +wctob +wctomb +wctrans +wctype +wcwidth +wdelch +wdeleteln +werase +wgetch +wgetstr +winch +winsch +winsertln +winsstr +wmemchr 64 +wmemcmp +wmemcpy 64 +wmemmove 64 +wmemset 64 +wmove +wprintf FLOAT64 FLOAT128 +wprintw FLOAT64 FLOAT128 +wrefresh +write +writev +wscanf FLOAT64 FLOAT128 +wscanw FLOAT64 FLOAT128 +wsetattr +wstandend +wstandout +y0 FLOAT64_VAXD DPML +y0l FLOAT64_VAXD +y1 FLOAT64_VAXD DPML +y1l FLOAT64_VAXD +yn FLOAT64_VAXD DPML +ynl FLOAT64_VAXD diff --git a/gcc-4.9/gcc/config/vms/vms-f.c b/gcc-4.9/gcc/config/vms/vms-f.c new file mode 100644 index 000000000..7027c0ef8 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms-f.c @@ -0,0 +1,31 @@ +/* VMS support needed only by Fortran frontends. + Copyright (C) 2012-2014 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" + +void +vms_c_register_includes (const char *sysroot ATTRIBUTE_UNUSED, + const char *iprefix ATTRIBUTE_UNUSED, + int stdinc ATTRIBUTE_UNUSED) +{ + /* No-op for fortran. */ +} diff --git a/gcc-4.9/gcc/config/vms/vms-ld.c b/gcc-4.9/gcc/config/vms/vms-ld.c new file mode 100644 index 000000000..a66479f46 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms-ld.c @@ -0,0 +1,968 @@ +/* VMS linker wrapper. + Copyright (C) 2011-2014 Free Software Foundation, Inc. + Contributed by AdaCore + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +/* This program is a wrapper around the VMS linker. + It translates Unix style command line options into corresponding + VMS style qualifiers and then spawns the VMS linker. + + It is possible to build this program on UNIX but only for the purpose of + checking for errors. */ + +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <stdio.h> + +#include "libiberty.h" +#include <safe-ctype.h> +#include <sys/stat.h> + +/* Macro for logicals. */ +#define LNM__STRING 2 +#define LNM_C_NAMLENGTH 255 +#define PSL_C_SUPER 2 +#define PSL_C_USER 3 + +/* Local variable declarations. */ +static int ld_nocall_debug = 0; +static int ld_mkthreads = 0; +static int ld_upcalls = 0; + +/* verbose = 1 if -v passed. */ +static int verbose = 0; + +/* save_temps = 1 if -save-temps passed. */ +static int save_temps = 0; + +/* By default don't generate executable file if there are errors + in the link. Override with --noinhibit-exec. */ +static int inhibit_exec = 1; + +/* debug = 1 if -g passed. */ +static int debug = 0; + +/* By default prefer to link with static libraries. */ +static int staticp = 1; + +/* By default generate an executable, not a shareable image library. + Override with -shared. */ +static int share = 0; + +/* Linker command line. */ +static int link_cmd_maxlen = 0; +static char *link_cmd = 0; +static int link_cmd_len = 0; + +/* Keep track of filenames. */ +static char *sharebasename; +static const char *exefullfilename; +static const char *exefilename; + +/* Search dir list passed on command line (with -L). */ +static const char **search_dirs; +static int search_dirs_len; + +/* Local function declarations. */ +static void addarg (const char *); +static int is_regular_file (char *); +static char *to_host_file_spec (char *); +static char *locate_lib (char *); +static const char *expand_lib (char *); +static void preprocess_args (int, char **); +static void process_args (int, char **); +static void maybe_set_link_compat (void); +static int set_exe (const char *); +#ifdef VMS +static int translate_unix (char *, int); +#endif + + +/* Append STR to the command line to invoke the linker. + Expand the line as necessary to accommodate. */ + +static void +addarg (const char *str) +{ + int l = strlen (str); + + /* Extend the line. */ + if (link_cmd_len + l >= link_cmd_maxlen) + { + link_cmd_maxlen = link_cmd_len + l + 1024; + link_cmd = XRESIZEVEC (char, link_cmd, link_cmd_maxlen); + } + + memcpy (link_cmd + link_cmd_len, str, l); + link_cmd_len += l; +} + +/* Check to see if NAME is a regular file, i.e. not a directory. */ + +static int +is_regular_file (char *name) +{ + int ret; + struct stat statbuf; + + ret = stat (name, &statbuf); + return !ret && S_ISREG (statbuf.st_mode); +} + +#ifdef VMS +static char new_host_filespec [255]; +static char filename_buff [256]; + +/* Action routine called by decc$to_vms. NAME is a file name or + directory name. TYPE is unused. */ + +static int +translate_unix (char *name, int type ATTRIBUTE_UNUSED) +{ + strcpy (filename_buff, name); + return 0; +} +#endif + +/* Translate a Unix syntax file specification FILESPEC into VMS syntax. + If indicators of VMS syntax found, return input string. + Return a pointer to a static buffer. */ + +static char * +to_host_file_spec (char *filespec) +{ +#ifdef VMS + if (strchr (filespec, ']') || strchr (filespec, ':')) + { + /* Looks like a VMS path. */ + return filespec; + } + else + { + + strcpy (filename_buff, filespec); + decc$to_vms (filespec, translate_unix, 1, 1); + strcpy (new_host_filespec, filename_buff); + return new_host_filespec; + } +#else + return filespec; +#endif +} + +/* Locate library LIB_NAME on the library path. */ + +static char * +locate_lib (char *lib_name) +{ + int lib_len = strlen (lib_name); + const char *exts[3]; + int i; + + if (staticp) + { + /* For static links, look for shareable image libraries last. */ + exts[0] = ".a"; + exts[1] = ".olb"; + exts[2] = ".exe"; + } + else + { + exts[0] = ".exe"; + exts[1] = ".a"; + exts[2] = ".olb"; + } + + for (i = 0; i < search_dirs_len; i++) + { + char *buf; + int l; + int j; + + l = strlen (search_dirs[i]); + buf = (char *)alloca (l + 4 + lib_len + 4 + 1); + /* Put PATH/libLIB. */ + memcpy (buf, search_dirs[i], l); + memcpy (buf + l, "/lib", 4); + l += 4; + memcpy (buf + l, lib_name, lib_len); + l += lib_len; + + /* Look for files with the extensions. */ + for (j = 0; j < 3; j++) + { + strcpy (buf + l, exts[j]); + if (is_regular_file (buf)) + return xstrdup (to_host_file_spec (buf)); + } + } + + return NULL; +} + +/* Given a library name NAME, i.e. foo, Look for libfoo.lib and then + libfoo.a in the set of directories we are allowed to search in. + May return NULL if the library can be discarded. */ + +static const char * +expand_lib (char *name) +{ + char *lib_path; + + /* Discard libc. */ + if (strcmp (name, "c") == 0) + return NULL; + + /* Discard libm. No separate library for math functions. */ + if (strcmp (name, "m") == 0) + return NULL; + + /* Search on path. */ + lib_path = locate_lib (name); + if (lib_path) + return lib_path; + + fprintf (stderr, + "Couldn't locate library: lib%s.exe, lib%s.a or lib%s.olb\n", + name, name, name); + + exit (EXIT_FAILURE); +} + +/* Preprocess the number of args P_ARGC in ARGV. + Look for special flags, etc. that must be handled first. */ + +static void +preprocess_args (int argc, char **argv) +{ + int i; + + /* Scan for -shared. */ + for (i = 1; i < argc; i++) + if (strcmp (argv[i], "-shared") == 0) + { + share = 1; + break; + } + + for (i = 1; i < argc; i++) + if (strcmp (argv[i], "-o") == 0) + { + int len; + + i++; + exefilename = lbasename (argv[i]); + exefullfilename = xstrdup (to_host_file_spec (argv[i])); + + if (share) + addarg(" /share="); + else + addarg (" /exe="); + addarg (exefullfilename); + + if (share) + { + char *ptr; + + /* Extract the basename. */ + ptr = strchr (argv[i], ']'); + if (ptr == NULL) + ptr = strchr (argv[i], ':'); + if (ptr == NULL) + ptr = strchr (argv[i], '/'); + if (ptr == NULL) + sharebasename = xstrdup (argv[i]); + else + sharebasename = xstrdup (ptr + 1); + + len = strlen (sharebasename); + if (strncasecmp (&sharebasename[len-4], ".exe", 4) == 0) + sharebasename[len - 4] = 0; + + /* Convert to uppercase. */ + for (ptr = sharebasename; *ptr; ptr++) + *ptr = TOUPPER (*ptr); + } + } + + if (exefullfilename == NULL && !share) + { + exefilename = "a_out.exe"; + exefullfilename = "a_out.exe"; + addarg (xstrdup (" /exe=a_out.exe")); + } +} + +/* Preprocess the number of args ARGC in ARGV. Look for + special flags, etc. that must be handled for the VMS linker. */ + +static void +process_args (int argc, char **argv) +{ + int i; + + for (i = 1; i < argc; i++) + { + if (strncmp (argv[i], "-L", 2) == 0) + { + search_dirs = XRESIZEVEC(const char *, search_dirs, + search_dirs_len + 1); + search_dirs[search_dirs_len++] = &argv[i][2]; + } + + /* -v turns on verbose option here and is passed on to gcc. */ + else if (strcmp (argv[i], "-v") == 0) + verbose++; + else if (strcmp (argv[i], "--version") == 0) + { + fprintf (stdout, "VMS Linker\n"); + exit (EXIT_SUCCESS); + } + else if (strcmp (argv[i], "--help") == 0) + { + fprintf (stdout, "VMS Linker\n"); + exit (EXIT_SUCCESS); + } + else if (strcmp (argv[i], "-g0") == 0) + addarg ("/notraceback"); + else if (strncmp (argv[i], "-g", 2) == 0) + { + addarg ("/debug"); + debug = 1; + } + else if (strcmp (argv[i], "-static") == 0) + staticp = 1; + else if (strcmp (argv[i], "-map") == 0) + { + char *buff, *ptr; + + buff = (char *) xstrdup (exefullfilename); + ptr = strrchr (buff, '.'); + if (ptr) + *ptr = 0; + + strcat (buff, ".map"); + addarg ("/map="); + addarg (buff); + addarg (".map"); + addarg ("/full"); + + free (buff); + } + else if (strcmp (argv[i], "-save-temps") == 0) + save_temps = 1; + else if (strcmp (argv[i], "--noinhibit-exec") == 0) + inhibit_exec = 0; + } +} + +#ifdef VMS +typedef struct dsc +{ + unsigned short len, mbz; + const char *adr; +} Descriptor; + +struct lst +{ + unsigned short buflen, item_code; + const void *bufaddr; + void *retlenaddr; +}; + +static struct +{ + struct lst items [1]; + unsigned int terminator; +} item_lst1; + +static struct +{ + struct lst items [2]; + unsigned int terminator; +} item_lst2; + +/* Checks if logical names are defined for setting system library path and + linker program to enable compatibility with earlier VMS versions. */ + +static void +maybe_set_link_compat (void) +{ + char lnm_buff [LNM_C_NAMLENGTH]; + unsigned int lnm_buff_len; + int status; + Descriptor tabledsc, linkdsc; + + tabledsc.adr = "LNM$JOB"; + tabledsc.len = strlen (tabledsc.adr); + tabledsc.mbz = 0; + + linkdsc.adr = "GCC_LD_SYS$LIBRARY"; + linkdsc.len = strlen (linkdsc.adr); + linkdsc.mbz = 0; + + item_lst1.items[0].buflen = LNM_C_NAMLENGTH; + item_lst1.items[0].item_code = LNM__STRING; + item_lst1.items[0].bufaddr = lnm_buff; + item_lst1.items[0].retlenaddr = &lnm_buff_len; + item_lst1.terminator = 0; + + status = SYS$TRNLNM + (0, /* attr */ + &tabledsc, /* tabnam */ + &linkdsc, /* lognam */ + 0, /* acmode */ + &item_lst1); + + /* If GCC_LD_SYS$LIBRARY is defined, redefine SYS$LIBRARY to search + the equivalence name first for system libraries, then the default + system library directory */ + + if ((status & 1) == 1) + { + unsigned char acmode = PSL_C_USER; /* Don't retain after image exit */ + const char *syslib = "SYS$SYSROOT:[SYSLIB]"; /* Default SYS$LIBRARY */ + + /* Only visible to current and child processes */ + tabledsc.adr = "LNM$PROCESS"; + tabledsc.len = strlen (tabledsc.adr); + tabledsc.mbz = 0; + + linkdsc.adr = "SYS$LIBRARY"; + linkdsc.len = strlen (linkdsc.adr); + linkdsc.mbz = 0; + + item_lst2.items[0].buflen = lnm_buff_len; + item_lst2.items[0].item_code = LNM__STRING; + item_lst2.items[0].bufaddr = lnm_buff; + item_lst2.items[0].retlenaddr = 0; + + item_lst2.items[1].buflen = strlen (syslib); + item_lst2.items[1].item_code = LNM__STRING; + item_lst2.items[1].bufaddr = syslib; + item_lst2.items[1].retlenaddr = 0; + item_lst2.terminator = 0; + + status = SYS$CRELNM + (0, /* attr */ + &tabledsc, /* tabnam */ + &linkdsc, /* lognam */ + &acmode, /* acmode */ + &item_lst2); + + } + + tabledsc.adr = "LNM$JOB"; + tabledsc.len = strlen (tabledsc.adr); + tabledsc.mbz = 0; + + linkdsc.adr = "GCC_LD_LINK"; + linkdsc.len = strlen (linkdsc.adr); + linkdsc.mbz = 0; + + item_lst1.items[0].buflen = LNM_C_NAMLENGTH; + item_lst1.items[0].item_code = LNM__STRING; + item_lst1.items[0].bufaddr = lnm_buff; + item_lst1.items[0].retlenaddr = &lnm_buff_len; + item_lst1.terminator = 0; + + status = SYS$TRNLNM + (0, /* attr */ + &tabledsc, /* tabnam */ + &linkdsc, /* lognam */ + 0, /* acmode */ + &item_lst1); + + /* If GCC_LD_LINK is defined, redefine LINK to use the equivalence name + (sometimes the LINK program version is used by VMS to determine + compatibility). */ + + if ((status & 1) == 1) + { + unsigned char acmode = PSL_C_USER; /* Don't retain after image exit. */ + + /* Only visible to current and child processes. */ + tabledsc.adr = "LNM$PROCESS"; + tabledsc.len = strlen (tabledsc.adr); + tabledsc.mbz = 0; + + linkdsc.adr = "LINK"; + linkdsc.len = strlen (linkdsc.adr); + linkdsc.mbz = 0; + + item_lst1.items[0].buflen = lnm_buff_len; + item_lst1.items[0].item_code = LNM__STRING; + item_lst1.items[0].bufaddr = lnm_buff; + item_lst1.items[0].retlenaddr = 0; + item_lst1.terminator = 0; + + status = SYS$CRELNM + (0, /* attr */ + &tabledsc, /* tabnam */ + &linkdsc, /* lognam */ + &acmode, /* acmode */ + &item_lst1); + } +} +#else +static void +maybe_set_link_compat (void) +{ +} +#endif + +/* Set environment defined executable attributes. */ + +static int +set_exe (const char *arg) +{ + char allargs [1024]; + int res; + + snprintf (allargs, sizeof (allargs), + "$@gnu:[bin]set_exe %s %s", exefullfilename, arg); + if (verbose) + printf ("%s\n", allargs); + + res = system (allargs); + if (verbose > 1) + printf ("$!status = %d\n", res); + + if ((res & 1) != 1) + { + fprintf (stderr, "ld error: popen set_exe\n"); + return 1; + } + return 0; +} + +/* The main program. Spawn the VMS linker after fixing up the Unix-like flags + and args to be what the VMS linker wants. */ + +int +main (int argc, char **argv) +{ + /* File specification for vms-dwarf2.o. */ + char *vmsdwarf2spec = 0; + + /* File specification for vms-dwarf2eh.o. */ + char *vmsdwarf2ehspec = 0; + + int i; + char cwdev[128], *devptr; + int cwdevlen; + FILE *optfile; + char *cwd, *ptr; + char *optfilename; + int status = 0; + + /* Some linker options can be set with logicals. */ + if (getenv ("GNAT$LD_NOCALL_DEBUG")) + ld_nocall_debug = 1; + if (getenv ("GNAT$LD_MKTHREADS")) + ld_mkthreads = 1; + if (getenv ("GNAT$LD_UPCALLS")) + ld_upcalls = 1; + if (getenv ("GNAT$LD_SHARED_LIBS")) + staticp = 0; + + /* Get current dir. */ +#ifdef VMS + cwd = getcwd (0, 1024, 1); +#else + cwd = getcwd (0, 1024); + strcat (cwd, "/"); +#endif + + /* Extract device part of the path. */ + devptr = strchr (cwd, ':'); + if (devptr) + cwdevlen = (devptr - cwd) + 1; + else + cwdevlen = 0; + memcpy (cwdev, cwd, cwdevlen); + cwdev [cwdevlen] = '\0'; + + maybe_set_link_compat (); + + /* Linker command starts with the command name. */ + addarg ("$ link"); + + /* Pass to find args that have to be append first. */ + preprocess_args (argc , argv); + + /* Pass to find the rest of the args. */ + process_args (argc , argv); + + if (!verbose) + addarg ("/noinform"); + + /* Create a temp file to hold args, otherwise we can easily exceed the VMS + command line length limits. */ + optfilename = (char *) xmalloc (strlen (exefilename) + 13); + strcpy (optfilename, exefilename); + ptr = strrchr (optfilename, '.'); + if (ptr) + *ptr = 0; + strcat (optfilename, ".opt_tmpfile"); + optfile = fopen (optfilename, "w"); + + /* Write out the IDENTIFICATION argument first so that it can be overridden + by an options file. */ + for (i = 1; i < argc; i++) + { + int arg_len = strlen (argv[i]); + + if (arg_len > 6 && strncasecmp (argv[i], "IDENT=", 6) == 0) + { + /* Comes from command line. If present will always appear before + --identification=... and will override. */ + break; + } + else if (arg_len > 17 + && strncasecmp (argv[i], "--identification=", 17) == 0) + { + /* Comes from pragma Ident (). */ + fprintf (optfile, "case_sensitive=yes\n"); + fprintf (optfile, "IDENTIFICATION=\"%-.15s\"\n", &argv[i][17]); + fprintf (optfile, "case_sensitive=NO\n"); + } + } + + for (i = 1; i < argc; i++) + { + int arg_len = strlen (argv[i]); + + if (strcmp (argv[i], "-o") == 0) + { + /* Already handled. */ + i++; + } + else if (arg_len > 2 && strncmp (argv[i], "-l", 2) == 0) + { + const char *libname; + + libname = expand_lib (&argv[i][2]); + if (libname != NULL) + { + int len = strlen (libname); + const char *ext; + + if (len > 4 && strcasecmp (&libname [len-4], ".exe") == 0) + ext = "/shareable"; + else + ext = "/library"; + + if (libname[0] == '[') + fprintf (optfile, "%s%s%s\n", cwdev, libname, ext); + else + fprintf (optfile, "%s%s\n", libname, ext); + } + } + else if (strcmp (argv[i], "-v" ) == 0 + || strncmp (argv[i], "-g", 2 ) == 0 + || strcmp (argv[i], "-static" ) == 0 + || strcmp (argv[i], "-map" ) == 0 + || strcmp (argv[i], "-save-temps") == 0 + || strcmp (argv[i], "--noinhibit-exec") == 0 + || (arg_len > 2 && strncmp (argv[i], "-L", 2) == 0) + || (arg_len >= 6 && strncmp (argv[i], "-share", 6) == 0)) + { + /* Already handled. */ + } + else if (strncmp (argv[i], "--opt=", 6) == 0) + fprintf (optfile, "%s\n", argv[i] + 6); + else if (arg_len > 1 && argv[i][0] == '@') + { + /* Read response file (in fact a single line of filenames). */ + FILE *atfile; + char *ptr, *ptr1; + struct stat statbuf; + char *buff; + int len; + + if (stat (&argv[i][1], &statbuf)) + { + fprintf (stderr, "Couldn't open linker response file: %s\n", + &argv[i][1]); + exit (EXIT_FAILURE); + } + + /* Read the line. */ + buff = (char *) xmalloc (statbuf.st_size + 1); + atfile = fopen (&argv[i][1], "r"); + fgets (buff, statbuf.st_size + 1, atfile); + fclose (atfile); + + /* Remove trailing \n. */ + len = strlen (buff); + if (buff [len - 1] == '\n') + { + buff [len - 1] = 0; + len--; + } + + /* Put the filenames to the opt file. */ + ptr = buff; + do + { + ptr1 = strchr (ptr, ' '); + if (ptr1) + *ptr1 = 0; + + /* Add device name if a path is present. */ + ptr = to_host_file_spec (ptr); + if (ptr[0] == '[') + fprintf (optfile, "%s%s\n", cwdev, ptr); + else + fprintf (optfile, "%s\n", ptr); + + ptr = ptr1 + 1; + } + while (ptr1); + } + else if ((argv[i][0] == '/') && (strchr (&argv[i][1], '/') == 0)) + { + /* Unix style file specs and VMS style switches look alike, + so assume an arg consisting of one and only one slash, + and that being first, is really a switch. */ + addarg (argv[i]); + } + else if (arg_len > 4 + && strncasecmp (&argv[i][arg_len-4], ".opt", 4) == 0) + { + /* Read option file. */ + FILE *optfile1; + char buff[256]; + + /* Disable __UNIX_FOPEN redefinition in case user supplied .opt + file is not stream oriented. */ + + optfile1 = (fopen) (argv[i], "r"); + if (optfile1 == 0) + { + perror (argv[i]); + status = 1; + goto cleanup_and_exit; + } + + while (fgets (buff, sizeof (buff), optfile1)) + fputs (buff, optfile); + + fclose (optfile1); + } + else if (arg_len > 7 && strncasecmp (argv[i], "GSMATCH", 7) == 0) + fprintf (optfile, "%s\n", argv[i]); + else if (arg_len > 6 && strncasecmp (argv[i], "IDENT=", 6) == 0) + { + /* Comes from command line and will override pragma. */ + fprintf (optfile, "case_sensitive=yes\n"); + fprintf (optfile, "IDENT=\"%15.15s\"\n", &argv[i][6]); + fprintf (optfile, "case_sensitive=NO\n"); + } + else if (arg_len > 17 + && strncasecmp (argv[i], "--identification=", 17) == 0) + { + /* Already handled. */ + } + else + { + /* Assume filename arg. */ + const char *file; + const char *addswitch = NULL; + char *buff; + int buff_len; + int is_cld = 0; + + file = to_host_file_spec (argv[i]); + arg_len = strlen (file); + + /* Handle shareable image libraries. */ + if (arg_len > 4 && strcasecmp (&file[arg_len - 4], ".exe") == 0) + addswitch = "/shareable"; + else if (arg_len > 4 && strcasecmp (&file[arg_len - 4], ".cld") == 0) + { + addswitch = "/shareable"; + is_cld = 1; + } + + /* Handle object libraries. */ + else if (arg_len > 2 && strcasecmp (&file[arg_len - 2], ".a") == 0) + addswitch = "/lib"; + else if (arg_len > 4 && strcasecmp (&file[arg_len - 4], ".olb") == 0) + addswitch = "/lib"; + + /* Absolutize file location. */ + if (file[0] == '[') + { + buff = (char *) xmalloc (cwdevlen + arg_len + 1); + sprintf (buff, "%s%s", cwdev, file); + } + else if (strchr (file, ':')) + { + buff = xstrdup (file); + } + else + { + buff = (char *) xmalloc (strlen (cwd) + arg_len + 1); + sprintf (buff, "%s%s", cwd, file); + } + + buff_len = strlen (buff); + + if (buff_len >= 15 + && strcasecmp (&buff[buff_len - 14], "vms-dwarf2eh.o") == 0) + { + /* Remind of it. */ + vmsdwarf2ehspec = xstrdup (buff); + } + else if (buff_len >= 13 + && strcasecmp (&buff[buff_len - 12], "vms-dwarf2.o") == 0) + { + /* Remind of it. */ + vmsdwarf2spec = xstrdup (buff); + } + else if (is_cld) + { + /* Command line definition file. */ + addarg (buff); + addarg (addswitch); + addarg (","); + } + else + { + fprintf (optfile, "%s%s\n", + buff, addswitch != NULL ? addswitch : ""); + } + free (buff); + } + } + + if (vmsdwarf2ehspec) + { + /* Sequentialize exception handling info. */ + + fprintf (optfile, "case_sensitive=yes\n"); + fprintf (optfile, "cluster=DWARF2eh,,,%s\n", vmsdwarf2ehspec); + fprintf (optfile, "collect=DWARF2eh,eh_frame\n"); + fprintf (optfile, "case_sensitive=NO\n"); + } + + if (debug && vmsdwarf2spec) + { + /* Sequentialize the debug info. */ + + fprintf (optfile, "case_sensitive=yes\n"); + fprintf (optfile, "cluster=DWARF2debug,,,%s\n", vmsdwarf2spec); + fprintf (optfile, "collect=DWARF2debug,debug_abbrev,debug_aranges,-\n"); + fprintf (optfile, " debug_frame,debug_info,debug_line,debug_loc,-\n"); + fprintf (optfile, " debug_macinfo,debug_pubnames,debug_str,-\n"); + fprintf (optfile, " debug_zzzzzz\n"); + fprintf (optfile, "case_sensitive=NO\n"); + } + + if (debug && share && vmsdwarf2spec) + { + /* Sequentialize the shared library debug info. */ + + fprintf (optfile, "case_sensitive=yes\n"); + fprintf (optfile, "symbol_vector=(-\n"); + fprintf (optfile, + "%s$DWARF2.DEBUG_ABBREV/$dwarf2.debug_abbrev=DATA,-\n", + sharebasename); + fprintf (optfile, + "%s$DWARF2.DEBUG_ARANGES/$dwarf2.debug_aranges=DATA,-\n", + sharebasename); + fprintf (optfile, "%s$DWARF2.DEBUG_FRAME/$dwarf2.debug_frame=DATA,-\n", + sharebasename); + fprintf (optfile, "%s$DWARF2.DEBUG_INFO/$dwarf2.debug_info=DATA,-\n", + sharebasename); + fprintf (optfile, "%s$DWARF2.DEBUG_LINE/$dwarf2.debug_line=DATA,-\n", + sharebasename); + fprintf (optfile, "%s$DWARF2.DEBUG_LOC/$dwarf2.debug_loc=DATA,-\n", + sharebasename); + fprintf (optfile, + "%s$DWARF2.DEBUG_MACINFO/$dwarf2.debug_macinfo=DATA,-\n", + sharebasename); + fprintf (optfile, + "%s$DWARF2.DEBUG_PUBNAMES/$dwarf2.debug_pubnames=DATA,-\n", + sharebasename); + fprintf (optfile, "%s$DWARF2.DEBUG_STR/$dwarf2.debug_str=DATA,-\n", + sharebasename); + fprintf (optfile, "%s$DWARF2.DEBUG_ZZZZZZ/$dwarf2.debug_zzzzzz=DATA)\n", + sharebasename); + fprintf (optfile, "case_sensitive=NO\n"); + } + + fprintf (optfile, "PSECT_ATTR=LIB$INITIALIZE,GBL\n"); + fclose (optfile); + + /* Append opt file. */ + addarg (" "); + addarg (optfilename); + addarg ("/opt"); + + if (verbose) + printf ("%s\n", link_cmd); + + status = system (link_cmd); + if (verbose > 1) + printf ("$!status = %d\n", status); + + if ((status & 1) != 1) + { + status = 1; + goto cleanup_and_exit; + } + + if (debug && !share && ld_nocall_debug) + { + status = set_exe ("/flags=nocall_debug"); + if (status != 0) + goto cleanup_and_exit; + } + + if (!share && ld_mkthreads) + { + status = set_exe ("/flags=mkthreads"); + if (status != 0) + goto cleanup_and_exit; + } + + if (!share && ld_upcalls) + { + status = set_exe ("/flags=upcalls"); + if (status != 0) + goto cleanup_and_exit; + } + + status = 0; + + cleanup_and_exit: + if (!save_temps) + remove (optfilename); + + if (status == 0) + exit (EXIT_SUCCESS); + + if (exefullfilename && inhibit_exec == 1) + remove (exefullfilename); + + exit (EXIT_FAILURE); +} diff --git a/gcc-4.9/gcc/config/vms/vms-opts.h b/gcc-4.9/gcc/config/vms/vms-opts.h new file mode 100644 index 000000000..261c59b63 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms-opts.h @@ -0,0 +1,30 @@ +/* Definitions for option handling for OpenVMS. + Copyright (C) 2012-2014 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + <http://www.gnu.org/licenses/>. */ + +#ifndef VMS_OPTS_H +#define VMS_OPTS_H + +enum vms_pointer_size + { + VMS_POINTER_SIZE_NONE, + VMS_POINTER_SIZE_32, + VMS_POINTER_SIZE_64 + }; + +#endif diff --git a/gcc-4.9/gcc/config/vms/vms-protos.h b/gcc-4.9/gcc/config/vms/vms-protos.h new file mode 100644 index 000000000..9b10159e6 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms-protos.h @@ -0,0 +1,35 @@ +/* Definitions of target machine for GCC for VMS. + Copyright (C) 2011-2014 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +/* vms-c.c */ +extern void vms_c_register_pragma (void); +extern void vms_c_common_override_options (void); +extern int vms_c_get_crtl_ver (void); +extern int vms_c_get_vms_ver (void); + +/* vms.c */ +void vms_patch_builtins (void); + +#ifdef TREE_CODE +extern section *vms_function_section (tree decl ATTRIBUTE_UNUSED, + enum node_frequency freq ATTRIBUTE_UNUSED, + bool startup ATTRIBUTE_UNUSED, + bool exit ATTRIBUTE_UNUSED); +extern void vms_start_function (const char *fname); +#endif /* TREE_CODE */ diff --git a/gcc-4.9/gcc/config/vms/vms-stdint.h b/gcc-4.9/gcc/config/vms/vms-stdint.h new file mode 100644 index 000000000..469e95550 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms-stdint.h @@ -0,0 +1,50 @@ +/* Definitions for <stdint.h> types on VMS systems. + Copyright (C) 2012-2014 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#define SIG_ATOMIC_TYPE "int" + +#define INT8_TYPE "signed char" +#define INT16_TYPE "short int" +#define INT32_TYPE "int" +#define INT64_TYPE "long long int" +#define UINT8_TYPE "unsigned char" +#define UINT16_TYPE "short unsigned int" +#define UINT32_TYPE "unsigned int" +#define UINT64_TYPE "long long unsigned int" + +#define INT_LEAST8_TYPE "signed char" +#define INT_LEAST16_TYPE "short int" +#define INT_LEAST32_TYPE "int" +#define INT_LEAST64_TYPE "long long int" +#define UINT_LEAST8_TYPE "unsigned char" +#define UINT_LEAST16_TYPE "short unsigned int" +#define UINT_LEAST32_TYPE "unsigned int" +#define UINT_LEAST64_TYPE "long long unsigned int" + +#define INT_FAST8_TYPE "signed char" +#define INT_FAST16_TYPE "short int" +#define INT_FAST32_TYPE "int" +#define INT_FAST64_TYPE "long long int" +#define UINT_FAST8_TYPE "unsigned char" +#define UINT_FAST16_TYPE "short unsigned int" +#define UINT_FAST32_TYPE "unsigned int" +#define UINT_FAST64_TYPE "long long unsigned int" + +#define INTPTR_TYPE "long long int" +#define UINTPTR_TYPE "long long unsigned int" diff --git a/gcc-4.9/gcc/config/vms/vms.c b/gcc-4.9/gcc/config/vms/vms.c new file mode 100644 index 000000000..0a8a5b894 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms.c @@ -0,0 +1,330 @@ +/* Definitions of target machine GNU compiler. 32bit VMS version. + Copyright (C) 2009-2014 Free Software Foundation, Inc. + Contributed by Douglas B Rupp (rupp@gnat.com). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tree.h" +#include "stringpool.h" +#include "vms-protos.h" +#include "ggc.h" +#include "target.h" +#include "output.h" +#include "tm.h" +#include "dwarf2out.h" + +/* Correlation of standard CRTL names with DECCRTL function names. */ + +/* Name is for a function that allocate memory. Use the 64bit version + if -mmalloc64. */ +#define VMS_CRTL_MALLOC (1 << 0) + +/* If long pointer are enabled, use _NAME64 instead. */ +#define VMS_CRTL_64 (1 << 1) + +/* Prepend s/f before the name. To be applied after the previous rule. + use 's' for S float, 'f' for IEEE 32. */ +#define VMS_CRTL_FLOAT32 (1 << 2) + +/* Prepend t/g/d before the name. To be applied after the previous rule. + use 'g' for VAX G float, 'd' for VAX D float, 't' for IEEE 64. */ +#define VMS_CRTL_FLOAT64 (1 << 3) + +/* Prepend d before the name, only if using VAX fp. */ +#define VMS_CRTL_FLOAT64_VAXD (1 << 4) + +/* Prepend x before the name for if 128 bit long doubles are enabled. This + concern mostly 'printf'-like functions. */ +#define VMS_CRTL_FLOAT128 (1 << 5) + +/* From xxx, create xxx, xxxf, xxxl using MATH$XXX_T, MATH$XXX_S + and MATH$XXX{_X} if DPML is used. */ +#define VMS_CRTL_DPML (1 << 6) + +/* Together with DPML, it means that all variant (ie xxx, xxxf and xxxl) are + overridden by decc. Without DPML, it means this is a variant (ie xxxf + or xxxl) of a function. */ +#define VMS_CRTL_NODPML (1 << 7) + +/* Prepend __bsd44_ before the name. To be applied after the P64 + rule. */ +#define VMS_CRTL_BSD44 (1 << 8) + +/* Define only in 32 bits mode, as this has no 64 bit variants. + Concerns getopt/getarg. */ +#define VMS_CRTL_32ONLY (1 << 9) + +/* GLobal data prefix (ga_, gl_...) */ +#define VMS_CRTL_G_MASK (7 << 10) +#define VMS_CRTL_G_NONE (0 << 10) +#define VMS_CRTL_GA (1 << 10) +#define VMS_CRTL_GL (2 << 10) + +/* Append '_2'. Not compatible with 64. */ +#define VMS_CRTL_FLOATV2 (1 << 13) + +struct vms_crtl_name +{ + /* The standard C name. */ + const char *const name; + + /* Flags to drive the translation. */ + unsigned int flags; +}; + +/* Map for the translation. */ + +static const struct vms_crtl_name vms_crtl_names[] = + { +#include "vms-crtlmap.h" + }; + +/* Number of entires in the above array. */ + +#define NBR_CRTL_NAMES (sizeof (vms_crtl_names) / sizeof (*vms_crtl_names)) + +/* List of aliased identifiers. They must be persistent across gc. */ + +static GTY(()) vec<tree, va_gc> *aliases_id; + +/* Add a CRTL translation. This simply use the transparent alias + mechanism, which is platform independent and works with the + #pragma extern_prefix (which set the assembler name). */ + +static void +vms_add_crtl_xlat (const char *name, size_t nlen, + const char *id_str, size_t id_len) +{ + tree targ; + + /* printf ("vms crtl: %.*s -> %.*s\n", nlen, name, id_len, id_str); */ + + targ = get_identifier_with_length (name, nlen); + gcc_assert (!IDENTIFIER_TRANSPARENT_ALIAS (targ)); + IDENTIFIER_TRANSPARENT_ALIAS (targ) = 1; + TREE_CHAIN (targ) = get_identifier_with_length (id_str, id_len); + + vec_safe_push (aliases_id, targ); +} + +/* Do VMS specific stuff on builtins: disable the ones that are not + standard, mangle names. */ + +void +vms_patch_builtins (void) +{ + /* enum built_in_function bi; */ + unsigned int i; + + /* Fwrite on VMS is non-standard. */ + if (builtin_decl_implicit_p (BUILT_IN_FWRITE)) + set_builtin_decl_implicit_p (BUILT_IN_FWRITE, false); + + if (builtin_decl_implicit_p (BUILT_IN_FWRITE_UNLOCKED)) + set_builtin_decl_implicit_p (BUILT_IN_FWRITE_UNLOCKED, false); + + /* Define aliases for names. */ + for (i = 0; i < NBR_CRTL_NAMES; i++) + { + const struct vms_crtl_name *n = &vms_crtl_names[i]; + char res[VMS_CRTL_MAXLEN + 3 + 9 + 1 + 1]; + int rlen; + int nlen = strlen (n->name); + + /* Discard 32ONLY if using 64 bit pointers. */ + if ((n->flags & VMS_CRTL_32ONLY) + && flag_vms_pointer_size == VMS_POINTER_SIZE_64) + continue; + + /* Handle DPML unless overridden by decc. */ + if ((n->flags & VMS_CRTL_DPML) + && !(n->flags & VMS_CRTL_NODPML)) + { + const char *p; + char alt[VMS_CRTL_MAXLEN + 3]; + + memcpy (res, "MATH$", 5); + rlen = 5; + for (p = n->name; *p; p++) + res[rlen++] = TOUPPER (*p); + res[rlen++] = '_'; + res[rlen++] = 'T'; + + /* Double version. */ + if (!(n->flags & VMS_CRTL_FLOAT64)) + vms_add_crtl_xlat (n->name, nlen, res, rlen); + + /* Float version. */ + res[rlen - 1] = 'S'; + memcpy (alt, n->name, nlen); + alt[nlen] = 'f'; + vms_add_crtl_xlat (alt, nlen + 1, res, rlen); + + /* Long double version. */ + res[rlen - 1] = (LONG_DOUBLE_TYPE_SIZE == 128 ? 'X' : 'T'); + alt[nlen] = 'l'; + vms_add_crtl_xlat (alt, nlen + 1, res, rlen); + + if (!(n->flags & (VMS_CRTL_FLOAT32 | VMS_CRTL_FLOAT64))) + continue; + } + + if (n->flags & VMS_CRTL_FLOAT64_VAXD) + continue; + + /* Add the dec-c prefix. */ + memcpy (res, "decc$", 5); + rlen = 5; + + if (n->flags & VMS_CRTL_BSD44) + { + memcpy (res + rlen, "__bsd44_", 8); + rlen += 8; + } + + if ((n->flags & VMS_CRTL_G_MASK) != VMS_CRTL_G_NONE) + { + res[rlen++] = 'g'; + switch (n->flags & VMS_CRTL_G_MASK) + { + case VMS_CRTL_GA: + res[rlen++] = 'a'; + break; + case VMS_CRTL_GL: + res[rlen++] = 'l'; + break; + default: + gcc_unreachable (); + } + res[rlen++] = '_'; + } + + if (n->flags & VMS_CRTL_FLOAT32) + res[rlen++] = 'f'; + + if (n->flags & VMS_CRTL_FLOAT64) + res[rlen++] = 't'; + + if ((n->flags & VMS_CRTL_FLOAT128) && LONG_DOUBLE_TYPE_SIZE == 128) + res[rlen++] = 'x'; + + memcpy (res + rlen, n->name, nlen); + + if ((n->flags & VMS_CRTL_64) == 0) + { + rlen += nlen; + + if (n->flags & VMS_CRTL_FLOATV2) + { + res[rlen++] = '_'; + res[rlen++] = '2'; + } + vms_add_crtl_xlat (n->name, nlen, res, rlen); + } + else + { + char alt[VMS_CRTL_MAXLEN + 3]; + bool use_64; + + /* Add three translations: + _X32 -> X + _X64 -> _X64 + X -> X if short, _X64 if long. */ + alt[0] = '_'; + memcpy (alt + 1, n->name, nlen); + alt[1 + nlen + 0] = '3'; + alt[1 + nlen + 1] = '2'; + alt[1 + nlen + 2] = 0; + vms_add_crtl_xlat (alt, nlen + 3, res, rlen + nlen); + + use_64 = (((n->flags & VMS_CRTL_64) + && flag_vms_pointer_size == VMS_POINTER_SIZE_64) + || ((n->flags & VMS_CRTL_MALLOC) + && flag_vms_malloc64 + && flag_vms_pointer_size != VMS_POINTER_SIZE_NONE)); + if (!use_64) + vms_add_crtl_xlat (n->name, nlen, res, rlen + nlen); + + res[rlen++] = '_'; + memcpy (res + rlen, n->name, nlen); + res[rlen + nlen + 0] = '6'; + res[rlen + nlen + 1] = '4'; + + if (use_64) + vms_add_crtl_xlat (n->name, nlen, res, rlen + nlen + 2); + + alt[1 + nlen + 0] = '6'; + alt[1 + nlen + 1] = '4'; + vms_add_crtl_xlat (alt, nlen + 3, res, rlen + nlen + 2); + } + } +} + +/* Always default to .text section. */ + +section * +vms_function_section (tree decl ATTRIBUTE_UNUSED, + enum node_frequency freq ATTRIBUTE_UNUSED, + bool startup ATTRIBUTE_UNUSED, + bool exit ATTRIBUTE_UNUSED) +{ + return NULL; +} + +/* Additionnal VMS specific code for start_function. */ + +/* Must be kept in sync with libgcc/config/vms/vms-ucrt0.c */ +#define VMS_MAIN_FLAGS_SYMBOL "__gcc_main_flags" +#define MAIN_FLAG_64BIT (1 << 0) +#define MAIN_FLAG_POSIX (1 << 1) + +void +vms_start_function (const char *fnname) +{ +#if VMS_DEBUGGING_INFO + if (vms_debug_main + && debug_info_level > DINFO_LEVEL_NONE + && strncmp (vms_debug_main, fnname, strlen (vms_debug_main)) == 0) + { + targetm.asm_out.globalize_label (asm_out_file, VMS_DEBUG_MAIN_POINTER); + ASM_OUTPUT_DEF (asm_out_file, VMS_DEBUG_MAIN_POINTER, fnname); + dwarf2out_vms_debug_main_pointer (); + vms_debug_main = 0; + } +#endif + + /* Registers flags used for function main. This is necessary for + crt0 code. */ + if (strcmp (fnname, "main") == 0) + { + unsigned int flags = 0; + + if (flag_vms_pointer_size == VMS_POINTER_SIZE_64) + flags |= MAIN_FLAG_64BIT; + if (!flag_vms_return_codes) + flags |= MAIN_FLAG_POSIX; + + targetm.asm_out.globalize_label (asm_out_file, VMS_MAIN_FLAGS_SYMBOL); + assemble_name (asm_out_file, VMS_MAIN_FLAGS_SYMBOL); + fprintf (asm_out_file, " = %u\n", flags); + } +} + +#include "gt-vms.h" diff --git a/gcc-4.9/gcc/config/vms/vms.h b/gcc-4.9/gcc/config/vms/vms.h new file mode 100644 index 000000000..dabc35189 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms.h @@ -0,0 +1,92 @@ +/* Definitions of target machine GNU compiler. VMS common version. + Copyright (C) 2003-2014 Free Software Foundation, Inc. + Contributed by Douglas B Rupp (rupp@gnat.com). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +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" + +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define_std ("vms"); \ + builtin_define_std ("VMS"); \ + builtin_assert ("system=vms"); \ + SUBTARGET_OS_CPP_BUILTINS(); \ + builtin_define ("__int64=long long"); \ + if (flag_vms_pointer_size == VMS_POINTER_SIZE_32) \ + builtin_define ("__INITIAL_POINTER_SIZE=32"); \ + else if (flag_vms_pointer_size == VMS_POINTER_SIZE_64) \ + builtin_define ("__INITIAL_POINTER_SIZE=64"); \ + if (POINTER_SIZE == 64) \ + builtin_define ("__LONG_POINTERS=1"); \ + builtin_define_with_int_value ("__CRTL_VER", vms_c_get_crtl_ver ()); \ + builtin_define_with_int_value ("__VMS_VER", vms_c_get_vms_ver ()); \ + } while (0) + +extern void vms_c_register_includes (const char *, const char *, int); +#define TARGET_EXTRA_INCLUDES vms_c_register_includes + +/* Tell compiler we want to support VMS pragmas */ +#define REGISTER_TARGET_PRAGMAS() vms_c_register_pragma () + +/* By default, allow $ to be part of an identifier. */ +#define DOLLARS_IN_IDENTIFIERS 2 + +#undef TARGET_ABI_OPEN_VMS +#define TARGET_ABI_OPEN_VMS 1 + +/* "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 (flag_vms_pointer_size == VMS_POINTER_SIZE_NONE ? 32 : 64) +#define POINTERS_EXTEND_UNSIGNED 0 + +/* Always a 32 bit type. */ +#undef SIZE_TYPE +#define SIZE_TYPE "unsigned int" + +/* ???: Defined as a 'int' by dec-c, but obstack.h doesn't like it. */ +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE (flag_vms_pointer_size == VMS_POINTER_SIZE_NONE ? \ + "int" : "long long int") + +#define SIZETYPE (flag_vms_pointer_size == VMS_POINTER_SIZE_NONE ? \ + "unsigned int" : "long long unsigned int") + +#define C_COMMON_OVERRIDE_OPTIONS vms_c_common_override_options () + +/* VMS doesn't support other sections than .text for code. */ +#define TARGET_ASM_FUNCTION_SECTION vms_function_section + +/* Always use 8 bytes addresses in dwarf2 debug info. The default value doesn't + work as it may be 4 bytes, which won't match gas default (8 bytes for ia64), + and will thus produce incorrect values. */ +#define DWARF2_ADDR_SIZE 8 + +/* No libm on VMS. */ +#define MATH_LIBRARY "" + +/* Special VMS debugger symbol to record the entry point. */ +#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO" + +#undef TARGET_LIBC_HAS_FUNCTION +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function diff --git a/gcc-4.9/gcc/config/vms/vms.opt b/gcc-4.9/gcc/config/vms/vms.opt new file mode 100644 index 000000000..7b6167d4a --- /dev/null +++ b/gcc-4.9/gcc/config/vms/vms.opt @@ -0,0 +1,63 @@ +; Copyright (C) 2009-2014 Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; GCC is free software; you can redistribute it and/or modify it under +; the terms of the GNU General Public License as published by the Free +; Software Foundation; either version 3, or (at your option) any later +; version. +; +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY +; WARRANTY; without even the implied warranty of MERCHANTABILITY or +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +; for more details. +; +; You should have received a copy of the GNU General Public License +; along with GCC; see the file COPYING3. If not see +; <http://www.gnu.org/licenses/>. + +HeaderInclude +config/vms/vms-opts.h + +map +Target RejectNegative + +mmalloc64 +Target Report Var(flag_vms_malloc64) Init(1) +Malloc data into P2 space + +mdebug-main= +Target RejectNegative Joined Var(vms_debug_main) +Set name of main routine for the debugger + +mvms-return-codes +Target Report Var(flag_vms_return_codes) +Use VMS exit codes instead of posix ones + +mpointer-size= +Target Joined Report RejectNegative Enum(vms_pointer_size) Var(flag_vms_pointer_size) Init(VMS_POINTER_SIZE_NONE) +-mpointer-size=[no,32,short,64,long] Set the default pointer size + +Enum +Name(vms_pointer_size) Type(enum vms_pointer_size) UnknownError(unknown pointer size model %qs) + +EnumValue +Enum(vms_pointer_size) String(no) Value(VMS_POINTER_SIZE_NONE) + +EnumValue +Enum(vms_pointer_size) String(32) Value(VMS_POINTER_SIZE_32) + +EnumValue +Enum(vms_pointer_size) String(short) Value(VMS_POINTER_SIZE_32) + +EnumValue +Enum(vms_pointer_size) String(64) Value(VMS_POINTER_SIZE_64) + +EnumValue +Enum(vms_pointer_size) String(long) Value(VMS_POINTER_SIZE_64) + +; The float representation format in effect for Ada +Variable +char vms_float_format = 'I' + +; This comment is to ensure we retain the blank line above. diff --git a/gcc-4.9/gcc/config/vms/x-vms b/gcc-4.9/gcc/config/vms/x-vms new file mode 100644 index 000000000..8bf8796f7 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/x-vms @@ -0,0 +1,26 @@ +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +LN = cp -p +LN_S = cp -p + +# Doesn't work on VMS +USE_COLLECT2= + +# There are no man pages on VMS +POD2MAN = false diff --git a/gcc-4.9/gcc/config/vms/xm-vms.h b/gcc-4.9/gcc/config/vms/xm-vms.h new file mode 100644 index 000000000..9e3800e18 --- /dev/null +++ b/gcc-4.9/gcc/config/vms/xm-vms.h @@ -0,0 +1,63 @@ +/* Configuration for GCC for hosting on VMS + using a Unix style C library. + Copyright (C) 1996-2014 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +/* A couple of conditionals for execution machine are controlled here. */ +#ifndef VMS +#define VMS +#endif + +/* Causes exit() to be redefined to __posix_exit() and + Posix compatible failure and success codes to be used. */ +#define _POSIX_EXIT 1 + +/* Open files in stream mode if not otherwise explicitly specified. */ +#define __UNIX_FOPEN 1 + +/* Write to stdout using fputc to avoid record terminators in pipes. */ +#define __UNIX_FWRITE 1 + +#define STDC_HEADERS 1 + +#define HOST_EXECUTABLE_SUFFIX ".exe" +#define HOST_OBJECT_SUFFIX ".obj" + +#define DUMPFILE_FORMAT "_%02d_" + +#define DELETE_IF_ORDINARY(NAME,ST,VERBOSE_FLAG) \ +do \ + { \ + while (stat (NAME, &ST) >= 0 && S_ISREG (ST.st_mode)) \ + if (unlink (NAME) < 0) \ + { \ + if (VERBOSE_FLAG) \ + perror_with_name (NAME); \ + break; \ + } \ + } while (0) + +/* If 64 bit pointers are used, use 64 bit specifier. */ + +#if (defined (__INITIAL_POINTER_SIZE) && __INITIAL_POINTER_SIZE == 64) \ + || defined (__LONG_POINTERS) +#define HOST_LONG_FORMAT "ll" +#define HOST_PTR_PRINTF "%llp" +#endif + +#define STANDARD_STARTFILE_PREFIX "/gnu/lib/" |