summaryrefslogtreecommitdiff
path: root/gcc/config/vms
diff options
context:
space:
mode:
authorrupp <rupp@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-30 00:15:35 +0000
committerrupp <rupp@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-30 00:15:35 +0000
commite783950f98bbbd276269a5435c9ce56de8e55608 (patch)
treea6efcbf8d498d4de1827d47e5e05d63da73aa6f0 /gcc/config/vms
parente70ad86ac565c31afaf95898838ae887e3b386d4 (diff)
downloadgcc-e783950f98bbbd276269a5435c9ce56de8e55608.tar.gz
* config/alpha/vms-cc.c: Deleted.
* config/alpha/vms-ld.c: Deleted. * config/alpha/t-vms64: Moved to config/vms * config/alpha/vms-crt0-64.c: Moved to config/vms * config/alpha/vms-crt0.c: Moved to config/vms * config/alpha/vms-psxcrt0-64.c: Moved to config/vms * config/alpha/vms-psxcrt0.c: Moved to config/vms * config/alpha/xm-vms.h: Moved to config/vms * config/alpha/x-vms: Moved to config/vms * config/alpha/t-vms (vcrt0.o, pcrt0.o): Move rules to new file config/vms/t-vms. * config/vms/t-vms: Moved here from config/alpha. Alpha specific parts removed. (STMP_FIXPROTO, STMP_FIXINC, LIMITS_H_TEST): Set. (version): Set. * config/vms/t-vms64: Moved here from config/alpha * config/vms/vms-crt0-64.c: Moved here from config/alpha. (argc,argv,envp): Enforce 32bit malloc'ing. * config/vms/vms-psxcrt0-64.c: Likewise. * config/vms/vms-crt0.c: Moved here from config/alpha. * config/vms/vms-psxcrt0.c: Likewise. * config/vms/vms-crtl-64.h: New file. * config/vms/vms-crtl.h: New file. * config/vms/vms.opt: New file. * config/vms/xm-vms64.h: New file. * config/vms/xm-vms.h: Moved here from config/alpha. (STANARD_EXEC_PREFIX, STANDARD_STARTFILE_PREFIX, STANDARD_INCLUDE_DIR): Set. * config/vms/x-vms: Moved here from config/alpha. (version, VMS_EXTRA_PARTS): Moved to t-vms. (vms-ld.o, vms-cc.o): Removed. (LN, LN_S, USE_COLLECT2, POD2MAN): Set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150230 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/vms')
-rw-r--r--gcc/config/vms/t-vms38
-rw-r--r--gcc/config/vms/t-vms6427
-rw-r--r--gcc/config/vms/vms-crt0-64.c95
-rw-r--r--gcc/config/vms/vms-crt0.c66
-rw-r--r--gcc/config/vms/vms-crtl-64.h190
-rw-r--r--gcc/config/vms/vms-crtl.h186
-rw-r--r--gcc/config/vms/vms-psxcrt0-64.c124
-rw-r--r--gcc/config/vms/vms-psxcrt0.c94
-rw-r--r--gcc/config/vms/vms.opt25
-rw-r--r--gcc/config/vms/x-vms27
-rw-r--r--gcc/config/vms/xm-vms.h58
-rw-r--r--gcc/config/vms/xm-vms64.h23
12 files changed, 953 insertions, 0 deletions
diff --git a/gcc/config/vms/t-vms b/gcc/config/vms/t-vms
new file mode 100644
index 00000000000..132a53b205c
--- /dev/null
+++ b/gcc/config/vms/t-vms
@@ -0,0 +1,38 @@
+# Copyright (C) 2009
+# 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/>.
+
+STMP_FIXPROTO =
+STMP_FIXINC =
+LIMITS_H_TEST = false
+
+# Under VMS, directory names cannot contain dots.
+version:=$(shell echo $(BASEVER_c) | sed -e 's/\./_/g')
+
+# Temporary restriction: VMS_EXTRA_PARTS must be compiled by DEC C.
+#VMS_EXTRA_PARTS=vcrt0.o pcrt0.o
+VMS_EXTRA_PARTS=
+
+DECC=`echo $(CC) | sed -e 's/xgcc -B.*/decc$(exeext)/' -e 's/^gcc/decc/' -e 's/^decc/.\/decc/' -e 's/\(.*\)-gcc/\1-decc/'`
+
+# Assemble startup files.
+$(T)vcrt0.o: $(CRT0_S) $(GCC_PASSES)
+ $(DECC) -c /names=as_is $(srcdir)/config/vms/vms-crt0.c -o $(T)vcrt0.o
+
+$(T)pcrt0.o: $(CRT0_S) $(GCC_PASSES)
+ $(DECC) -c /names=as_is $(srcdir)/config/vms/vms-psxcrt0.c -o $(T)pcrt0.o
diff --git a/gcc/config/vms/t-vms64 b/gcc/config/vms/t-vms64
new file mode 100644
index 00000000000..2fe00692fb5
--- /dev/null
+++ b/gcc/config/vms/t-vms64
@@ -0,0 +1,27 @@
+# Copyright (C) 2009
+# 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/>.
+
+# Assemble startup files.
+$(T)vcrt0.o: $(CRT0_S) $(GCC_PASSES)
+ $(DECC) -c /names=as_is /pointer_size=64 \
+ $(srcdir)/config/vms/vms-crt0-64.c -o $(T)vcrt0.o
+
+$(T)pcrt0.o: $(CRT0_S) $(GCC_PASSES)
+ $(DECC) -c /names=as_is /pointer_size=64 \
+ $(srcdir)/config/vms/vms-psxcrt0-64.c -o $(T)pcrt0.o
diff --git a/gcc/config/vms/vms-crt0-64.c b/gcc/config/vms/vms-crt0-64.c
new file mode 100644
index 00000000000..ec59d81d6af
--- /dev/null
+++ b/gcc/config/vms/vms-crt0-64.c
@@ -0,0 +1,95 @@
+/* VMS 64bit crt0 returning VMS style condition codes .
+ Copyright (C) 2001, 2009 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#if !defined(__DECC)
+You Lose! This file can only be compiled with DEC C.
+#else
+
+/* This file can only be compiled with DEC C, due to the call to
+ lib$establish and the pragmas pointer_size. */
+
+#pragma __pointer_size short
+
+#include <stdlib.h>
+#include <string.h>
+#include <ssdef.h>
+
+extern void decc$main ();
+
+extern int main ();
+
+static int
+handler (sigargs, mechargs)
+ void *sigargs;
+ void *mechargs;
+{
+ return SS$_RESIGNAL;
+}
+
+int
+__main (arg1, arg2, arg3, image_file_desc, arg5, arg6)
+ void *arg1, *arg2, *arg3;
+ void *image_file_desc;
+ void *arg5, *arg6;
+{
+ int argc;
+ char **argv;
+ char **envp;
+
+#pragma __pointer_size long
+
+ int i;
+ char **long_argv;
+ char **long_envp;
+
+#pragma __pointer_size short
+
+ lib$establish (handler);
+ decc$main (arg1, arg2, arg3, image_file_desc,
+ arg5, arg6, &argc, &argv, &envp);
+
+#pragma __pointer_size long
+
+ /* Reallocate argv with 64 bit pointers. */
+ long_argv = (char **) _malloc32 (sizeof (char *) * (argc + 1));
+
+ for (i = 0; i < argc; i++)
+ long_argv[i] = (char *) _strdup32 (argv[i]);
+
+ long_argv[argc] = (char *) 0;
+
+ for (i = 0; envp[i]; i++);
+ long_envp = (char **) _malloc32 (sizeof (char *) * (i + 1));
+
+ for (i = 0; envp[i]; i++)
+ long_envp[i] = (char *) _strdup32 (envp[i]);
+
+ long_envp[i] = (char *) 0;
+
+#pragma __pointer_size short
+
+ return main (argc, long_argv, long_envp);
+}
+#endif
diff --git a/gcc/config/vms/vms-crt0.c b/gcc/config/vms/vms-crt0.c
new file mode 100644
index 00000000000..c0fdaaf16c6
--- /dev/null
+++ b/gcc/config/vms/vms-crt0.c
@@ -0,0 +1,66 @@
+/* VMS crt0 returning VMS style condition codes .
+ Copyright (C) 2001, 2009 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#if !defined(__DECC)
+You Lose! This file can only be compiled with DEC C.
+#else
+
+/* This file can only be compiled with DEC C, due to the call to
+ lib$establish. */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ssdef.h>
+
+extern void decc$main ();
+
+extern int main ();
+
+static int
+handler (sigargs, mechargs)
+ void *sigargs;
+ void *mechargs;
+{
+ return SS$_RESIGNAL;
+}
+
+int
+__main (arg1, arg2, arg3, image_file_desc, arg5, arg6)
+ void *arg1, *arg2, *arg3;
+ void *image_file_desc;
+ void *arg5, *arg6;
+{
+ int argc;
+ char **argv;
+ char **envp;
+
+ lib$establish (handler);
+
+ decc$main(arg1, arg2, arg3, image_file_desc, arg5, arg6,
+ &argc, &argv, &envp);
+
+ return main (argc, argv, envp);
+}
+#endif
diff --git a/gcc/config/vms/vms-crtl-64.h b/gcc/config/vms/vms-crtl-64.h
new file mode 100644
index 00000000000..6b91f31558a
--- /dev/null
+++ b/gcc/config/vms/vms-crtl-64.h
@@ -0,0 +1,190 @@
+/* Definitions of target machine GNU compiler. 64bit VMS version.
+ Copyright (C) 2009 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/>. */
+
+/*
+ Correlation array of 64bit standard CRTL names with DECCRTL
+ function names. Currently contains only a partial list,
+ e.g. those functions use in GNAT and GCC. Memory allocation
+ routines are 32bit but this can be overridden by -mmalloc
+ subtarget switch.
+
+ Note: Please keep in alphabetical order.
+*/
+
+#undef CRTL_NAMES
+#define CRTL_NAMES \
+{ \
+{"_calloc32", "decc$calloc", 0}, \
+{"_malloc32", "decc$malloc", 0}, \
+{"_realloc32", "decc$realloc", 0}, \
+{"_strdup32", "decc$strdup", 0}, \
+{"abs", "decc$abs", 0}, \
+{"abort", "decc$abort", 0}, \
+{"access", "decc$access", 0}, \
+{"accept", "decc$accept", 0}, \
+{"acos", "decc$tacos", 0}, \
+{"alarm", "decc$alarm", 0}, \
+{"asin", "decc$tasin", 0}, \
+{"atan", "decc$tatan", 0}, \
+{"atan2", "decc$tatan2", 0}, \
+{"atexit", "decc$atexit", 0}, \
+{"atoi", "decc$atoi", 0}, \
+{"atoll", "decc$atoll", 0}, \
+{"atoq", "decc$atoq", 0}, \
+{"basename", "decc$_basename64", 0}, \
+{"bcmp", "decc$bcmp", 0}, \
+{"bcopy", "decc$bcopy", 0}, \
+{"bsearch", "decc$_bsearch64", 0}, \
+{"bzero", "decc$bzero", 0}, \
+{"calloc", "decc$calloc", 0}, \
+{"ceil", "decc$tceil", 0}, \
+{"chdir", "decc$chdir", 0}, \
+{"chown", "decc$chown", 0}, \
+{"clearerr", "decc$clearerr", 0}, \
+{"clock", "decc$clock", 0}, \
+{"close", "decc$close", 0}, \
+{"cos", "decc$tcos", 0}, \
+{"connect", "decc$connect", 0}, \
+{"ctime", "decc$ctime", 0}, \
+{"dup", "decc$dup", 0}, \
+{"dup2", "decc$dup2", 0}, \
+{"exit", "decc$exit", 0}, \
+{"exp", "decc$texp", 0}, \
+{"fabs", "decc$tfabs", 0}, \
+{"fclose", "decc$fclose", 0}, \
+{"fdopen", "decc$fdopen", 0}, \
+{"fgetc", "decc$fgetc", 0}, \
+{"fgets", "decc$_fgets64", 0}, \
+{"fflush", "decc$fflush", 0}, \
+{"ffs", "decc$ffs", 0}, \
+{"floor", "decc$tfloor", 0}, \
+{"fopen", "decc$fopen", 0}, \
+{"fputc", "decc$fputc", 0}, \
+{"fputs", "decc$fputs", 0}, \
+{"free", "decc$free", 0}, \
+{"fread", "decc$fread", 0}, \
+{"freopen", "decc$freopen", 0}, \
+{"fseek", "decc$fseek", 0}, \
+{"ftell", "decc$ftell", 0}, \
+{"fwrite", "decc$fwrite", 0}, \
+{"getcwd", "decc$_getcwd64", 0}, \
+{"getegid", "decc$getegid", 0}, \
+{"getenv", "decc$getenv", 0}, \
+{"geteuid", "decc$geteuid", 0}, \
+{"getgid", "decc$getgid", 0}, \
+{"gethostbyname","decc$gethostbyname",0}, \
+{"getpagesize", "decc$getpagesize", 0}, \
+{"getpid", "decc$getpid", 0}, \
+{"getservbyname","decc$getservbyname",0}, \
+{"gettimeofday", "decc$gettimeofday", 0}, \
+{"getuid", "decc$getuid", 0}, \
+{"htons", "decc$htons", 0}, \
+{"iconv", "decc$iconv", 0}, \
+{"index", "decc$_index64", 0}, \
+{"isatty", "decc$isatty", 0}, \
+{"isdigit", "decc$isdigit", 0}, \
+{"kill", "decc$kill", 0}, \
+{"log", "decc$tlog", 0}, \
+{"log10", "decc$tlog10", 0}, \
+{"lseek", "decc$lseek", 0}, \
+{"ioctl", "decc$ioctl", 0}, \
+{"malloc", "decc$malloc", 0}, \
+{"mbstowcs", "decc$_mbstowcs64", 0}, \
+{"memchr", "decc$_memchr64", 0}, \
+{"memcmp", "decc$memcmp", 0}, \
+{"memcpy", "decc$_memcpy64", 0}, \
+{"memmove", "decc$_memmove64", 0}, \
+{"memset", "decc$_memset64", 0}, \
+{"mkstemp", "decc$mkstemp", 0}, \
+{"mktemp", "decc$_mktemp64", 0}, \
+{"mmap", "decc$_mmap64", 0}, \
+{"munmap", "decc$munmap", 0}, \
+{"nl_langinfo", "decc$nl_langinfo", 0}, \
+{"pclose", "decc$pclose", 0}, \
+{"popen", "decc$popen", 0}, \
+{"pow", "decc$tpow", 0}, \
+{"printf", "decc$txprintf", 0}, \
+{"putenv", "decc$putenv", 0}, \
+{"puts", "decc$puts", 0}, \
+{"random", "decc$random", 0}, \
+{"read", "decc$read", 0}, \
+{"realloc", "decc$realloc", 0}, \
+{"recv", "decc$recv", 0}, \
+{"recvfrom", "decc$recvfrom", 0}, \
+{"rename", "decc$rename", 0}, \
+{"rewind", "decc$rewind", 0}, \
+{"rindex", "decc$_rindex64", 0}, \
+{"rmdir", "decc$rmdir", 0}, \
+{"send", "decc$send", 0}, \
+{"sendto", "decc$sendto", 0}, \
+{"setenv", "decc$setenv", 0}, \
+{"setlocale", "decc$setlocale", 0}, \
+{"setvbuf", "decc$setvbuf", 0}, \
+{"signal", "decc$signal", 0}, \
+{"sigsetmask", "decc$sigsetmask", 0}, \
+{"sin", "decc$tsin", 0}, \
+{"snprintf", "decc$txsnprintf", 0}, \
+{"socket", "decc$socket", 0}, \
+{"sqrt", "decc$tsqrt", 0}, \
+{"strcasecmp", "decc$strcasecmp", 0}, \
+{"strchr", "decc$_strchr64", 0}, \
+{"strcpy", "decc$_strcpy64", 0}, \
+{"strdup", "decc$strdup", 0}, \
+{"strerror", "decc$strerror", 0}, \
+{"strlen", "decc$strlen", 0}, \
+{"strncasecmp", "decc$strncasecmp", 0}, \
+{"strncmp", "decc$strncmp", 0}, \
+{"strncpy", "decc$_strncpy64", 0}, \
+{"strrchr", "decc$_strrchr64", 0}, \
+{"strstr", "decc$_strstr64", 0}, \
+{"strtod", "decc$t_strtod64", 0}, \
+{"strtol", "decc$_strtoll64", 0}, \
+{"strtoul", "decc$_strtoull64", 0}, \
+{"sysconf", "decc$sysconf", 0}, \
+{"system", "decc$system", 0}, \
+{"tan", "decc$ttan", 0}, \
+{"time", "decc$time", 0}, \
+{"times", "decc$times", 0}, \
+{"tmpfile", "decc$tmpfile", 0}, \
+{"tmpnam", "decc$_tmpnam64", 0}, \
+{"ungetc", "decc$ungetc", 0}, \
+{"unlink", "decc$unlink", 0}, \
+{"umask", "decc$umask", 0}, \
+{"utime", "decc$utime", 0}, \
+{"wait", "decc$wait", 0}, \
+{"waitpid", "decc$waitpid", 0}, \
+{"wcswidth", "decc$wcswidth", 0}, \
+{"write", "decc$write", 0}, \
+{"vfprintf", "decc$txvfprintf", 0}, \
+{"vprintf", "decc$txvprintf", 0}, \
+{"vsprintf", "decc$txvsprintf", 0}, \
+{"vsnprintf", "decc$txvsnprintf", 0}, \
+{NULL, NULL, 0} \
+}
+
+/* Initialize of libfuncs that are 32/64 bit memory specific. */
+
+#undef MEM_LIBFUNCS_INIT
+#define MEM_LIBFUNCS_INIT \
+do { \
+ memcpy_libfunc = init_one_libfunc ("decc$_memcpy64"); \
+ memmove_libfunc = init_one_libfunc ("decc$_memmove64"); \
+ memset_libfunc = init_one_libfunc ("decc$_memset64"); \
+} while (0)
diff --git a/gcc/config/vms/vms-crtl.h b/gcc/config/vms/vms-crtl.h
new file mode 100644
index 00000000000..39e647ac436
--- /dev/null
+++ b/gcc/config/vms/vms-crtl.h
@@ -0,0 +1,186 @@
+/* Definitions of target machine GNU compiler. 32bit VMS version.
+ Copyright (C) 2009 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/>. */
+
+/*
+ Correlation array of standard CRTL names with DECCRTL
+ function names. Currently contains only a partial list,
+ e.g. those functions use in GNAT and GCC
+
+ Note: Please keep in alphabetical order.
+*/
+
+#define CRTL_NAMES \
+{ \
+{"_calloc32", "decc$calloc", 0}, \
+{"_malloc32", "decc$malloc", 0}, \
+{"_realloc32", "decc$realloc", 0}, \
+{"_strdup32", "decc$strdup", 0}, \
+{"abs", "decc$abs", 0}, \
+{"abort", "decc$abort", 0}, \
+{"access", "decc$access", 0}, \
+{"accept", "decc$accept", 0}, \
+{"acos", "decc$tacos", 0}, \
+{"alarm", "decc$alarm", 0}, \
+{"asin", "decc$tasin", 0}, \
+{"atan", "decc$tatan", 0}, \
+{"atan2", "decc$tatan2", 0}, \
+{"atexit", "decc$atexit", 0}, \
+{"atoi", "decc$atoi", 0}, \
+{"atoll", "decc$atoll", 0}, \
+{"atoq", "decc$atoq", 0}, \
+{"basename", "decc$basename", 0}, \
+{"bcmp", "decc$bcmp", 0}, \
+{"bcopy", "decc$bcopy", 0}, \
+{"bsearch", "decc$bsearch", 0}, \
+{"bzero", "decc$bzero", 0}, \
+{"calloc", "decc$calloc", 0}, \
+{"ceil", "decc$tceil", 0}, \
+{"chdir", "decc$chdir", 0}, \
+{"chown", "decc$chown", 0}, \
+{"clearerr", "decc$clearerr", 0}, \
+{"clock", "decc$clock", 0}, \
+{"close", "decc$close", 0}, \
+{"cos", "decc$tcos", 0}, \
+{"connect", "decc$connect", 0}, \
+{"ctime", "decc$ctime", 0}, \
+{"dup", "decc$dup", 0}, \
+{"dup2", "decc$dup2", 0}, \
+{"exit", "decc$exit", 0}, \
+{"exp", "decc$texp", 0}, \
+{"fabs", "decc$tfabs", 0}, \
+{"fclose", "decc$fclose", 0}, \
+{"fdopen", "decc$fdopen", 0}, \
+{"fgetc", "decc$fgetc", 0}, \
+{"fgets", "decc$fgets", 0}, \
+{"fflush", "decc$fflush", 0}, \
+{"ffs", "decc$ffs", 0}, \
+{"floor", "decc$tfloor", 0}, \
+{"fopen", "decc$fopen", 0}, \
+{"fputc", "decc$fputc", 0}, \
+{"fputs", "decc$fputs", 0}, \
+{"free", "decc$free", 0}, \
+{"fread", "decc$fread", 0}, \
+{"freopen", "decc$freopen", 0}, \
+{"fseek", "decc$fseek", 0}, \
+{"ftell", "decc$ftell", 0}, \
+{"fwrite", "decc$fwrite", 0}, \
+{"getcwd", "decc$getcwd", 0}, \
+{"getegid", "decc$getegid", 0}, \
+{"getenv", "decc$getenv", 0}, \
+{"geteuid", "decc$geteuid", 0}, \
+{"getgid", "decc$getgid", 0}, \
+{"gethostbyname","decc$gethostbyname",0}, \
+{"getpagesize", "decc$getpagesize", 0}, \
+{"getpid", "decc$getpid", 0}, \
+{"getservbyname","decc$getservbyname",0}, \
+{"gettimeofday", "decc$gettimeofday", 0}, \
+{"getuid", "decc$getuid", 0}, \
+{"htons", "decc$htons", 0}, \
+{"iconv", "decc$iconv", 0}, \
+{"index", "decc$index", 0}, \
+{"isatty", "decc$isatty", 0}, \
+{"isdigit", "decc$isdigit", 0}, \
+{"kill", "decc$kill", 0}, \
+{"log", "decc$tlog", 0}, \
+{"log10", "decc$tlog10", 0}, \
+{"lseek", "decc$lseek", 0}, \
+{"ioctl", "decc$ioctl", 0}, \
+{"malloc", "decc$malloc", 0}, \
+{"mbstowcs", "decc$mbstowcs", 0}, \
+{"memchr", "decc$memchr", 0}, \
+{"memcmp", "decc$memcmp", 0}, \
+{"memcpy", "decc$memcpy", 0}, \
+{"memmove", "decc$memmove", 0}, \
+{"memset", "decc$memset", 0}, \
+{"mkstemp", "decc$mkstemp", 0}, \
+{"mktemp", "decc$mktemp", 0}, \
+{"mmap", "decc$mmap", 0}, \
+{"munmap", "decc$munmap", 0}, \
+{"nl_langinfo", "decc$nl_langinfo", 0}, \
+{"pclose", "decc$pclose", 0}, \
+{"popen", "decc$popen", 0}, \
+{"pow", "decc$tpow", 0}, \
+{"printf", "decc$txprintf", 0}, \
+{"putenv", "decc$putenv", 0}, \
+{"puts", "decc$puts", 0}, \
+{"random", "decc$random", 0}, \
+{"read", "decc$read", 0}, \
+{"realloc", "decc$realloc", 0}, \
+{"recv", "decc$recv", 0}, \
+{"recvfrom", "decc$recvfrom", 0}, \
+{"rename", "decc$rename", 0}, \
+{"rewind", "decc$rewind", 0}, \
+{"rindex", "decc$rindex", 0}, \
+{"rmdir", "decc$rmdir", 0}, \
+{"send", "decc$send", 0}, \
+{"sendto", "decc$sendto", 0}, \
+{"setenv", "decc$setenv", 0}, \
+{"setlocale", "decc$setlocale", 0}, \
+{"setvbuf", "decc$setvbuf", 0}, \
+{"signal", "decc$signal", 0}, \
+{"sigsetmask", "decc$sigsetmask", 0}, \
+{"sin", "decc$tsin", 0}, \
+{"snprintf", "decc$txsnprintf", 0}, \
+{"socket", "decc$socket", 0}, \
+{"sqrt", "decc$tsqrt", 0}, \
+{"strcasecmp", "decc$strcasecmp", 0}, \
+{"strchr", "decc$strchr", 0}, \
+{"strcpy", "decc$strcpy", 0}, \
+{"strdup", "decc$strdup", 0}, \
+{"strerror", "decc$strerror", 0}, \
+{"strlen", "decc$strlen", 0}, \
+{"strncasecmp", "decc$strncasecmp", 0}, \
+{"strncmp", "decc$strncmp", 0}, \
+{"strncpy", "decc$strncpy", 0}, \
+{"strrchr", "decc$strrchr", 0}, \
+{"strstr", "decc$strstr", 0}, \
+{"strtod", "decc$tstrtod", 0}, \
+{"strtol", "decc$strtoll", 0}, \
+{"strtoul", "decc$strtoull", 0}, \
+{"sysconf", "decc$sysconf", 0}, \
+{"system", "decc$system", 0}, \
+{"tan", "decc$ttan", 0}, \
+{"time", "decc$time", 0}, \
+{"times", "decc$times", 0}, \
+{"tmpfile", "decc$tmpfile", 0}, \
+{"tmpnam", "decc$tmpnam", 0}, \
+{"ungetc", "decc$ungetc", 0}, \
+{"unlink", "decc$unlink", 0}, \
+{"umask", "decc$umask", 0}, \
+{"utime", "decc$utime", 0}, \
+{"wait", "decc$wait", 0}, \
+{"waitpid", "decc$waitpid", 0}, \
+{"wcswidth", "decc$wcswidth", 0}, \
+{"write", "decc$write", 0}, \
+{"vfprintf", "decc$txvfprintf", 0}, \
+{"vprintf", "decc$txvprintf", 0}, \
+{"vsprintf", "decc$txvsprintf", 0}, \
+{"vsnprintf", "decc$txvsnprintf", 0}, \
+{NULL, NULL, 0} \
+}
+
+/* Initialize of libfuncs that are 32/64 bit memory specific. */
+
+#define MEM_LIBFUNCS_INIT \
+do { \
+ memcpy_libfunc = init_one_libfunc ("decc$memcpy"); \
+ memmove_libfunc = init_one_libfunc ("decc$memmove"); \
+ memset_libfunc = init_one_libfunc ("decc$memset"); \
+} while (0)
diff --git a/gcc/config/vms/vms-psxcrt0-64.c b/gcc/config/vms/vms-psxcrt0-64.c
new file mode 100644
index 00000000000..45afbc9a03d
--- /dev/null
+++ b/gcc/config/vms/vms-psxcrt0-64.c
@@ -0,0 +1,124 @@
+/* VMS 64bit crt0 returning Unix style condition codes .
+ Copyright (C) 2001, 2009 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#if !defined(__DECC)
+You Lose! This file can only be compiled with DEC C.
+#else
+
+/* This file can only be compiled with DEC C, due to the call to
+ lib$establish and the pragmas pointer_size. */
+
+#pragma __pointer_size short
+
+#include <stdlib.h>
+#include <string.h>
+#include <ssdef.h>
+#include <stsdef.h>
+#include <errnodef.h>
+
+extern void decc$main ();
+extern int main ();
+
+static int
+handler (sigargs, mechargs)
+ void *sigargs;
+ void *mechargs;
+{
+ return SS$_RESIGNAL;
+}
+
+int
+__main (arg1, arg2, arg3, image_file_desc, arg5, arg6)
+ void *arg1, *arg2, *arg3;
+ void *image_file_desc;
+ void *arg5, *arg6;
+{
+ int argc;
+ char **argv;
+ char **envp;
+
+#pragma __pointer_size long
+
+ int i;
+ char **long_argv;
+ char **long_envp;
+ int status;
+
+#pragma __pointer_size short
+
+ lib$establish (handler);
+ decc$main (arg1, arg2, arg3, image_file_desc,
+ arg5, arg6, &argc, &argv, &envp);
+
+#pragma __pointer_size long
+
+ /* Reallocate argv with 64 bit pointers. */
+ long_argv = (char **) _malloc32 (sizeof (char *) * (argc + 1));
+
+ for (i = 0; i < argc; i++)
+ long_argv[i] = (char *) _strdup32 (argv[i]);
+
+ long_argv[argc] = (char *) 0;
+
+ for (i = 0; envp[i]; i++);
+ long_envp = (char **) _malloc32 (sizeof (char *) * (i + 1));
+
+ for (i = 0; envp[i]; i++)
+ long_envp[i] = (char *) _strdup32 (envp[i]);
+
+ long_envp[i] = (char *) 0;
+
+#pragma __pointer_size short
+
+ status = main (argc, long_argv, long_envp);
+
+ /* Map into a range of 0 - 255. */
+ status = status & 255;
+
+ if (status > 0)
+ {
+ int save_status = status;
+
+ status = C$_EXIT1 + ((status - 1) << STS$V_MSG_NO);
+
+ /* An exit failure status requires a "severe" error. All status values
+ are defined in errno with a successful (1) severity but can be
+ changed to an error (2) severity by adding 1. In addition for
+ compatibility with UNIX exit() routines we inhibit a run-time error
+ message from being generated on exit(1). */
+
+ if (save_status == 1)
+ {
+ status++;
+ status |= STS$M_INHIB_MSG;
+ }
+ }
+
+ if (status == 0)
+ status = SS$_NORMAL;
+
+ return status;
+}
+#endif
diff --git a/gcc/config/vms/vms-psxcrt0.c b/gcc/config/vms/vms-psxcrt0.c
new file mode 100644
index 00000000000..5ad5ddb0fd8
--- /dev/null
+++ b/gcc/config/vms/vms-psxcrt0.c
@@ -0,0 +1,94 @@
+/* VMS crt0 returning Unix style condition codes .
+ Copyright (C) 2001, 2009 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#if !defined(__DECC)
+You Lose! This file can only be compiled with DEC C.
+#else
+
+/* This file can only be compiled with DEC C, due to the call to
+ lib$establish. */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ssdef.h>
+#include <stsdef.h>
+#include <errnodef.h>
+
+extern void decc$main ();
+extern int main ();
+
+static int
+handler (sigargs, mechargs)
+ void *sigargs;
+ void *mechargs;
+{
+ return SS$_RESIGNAL;
+}
+
+int
+__main (arg1, arg2, arg3, image_file_desc, arg5, arg6)
+ void *arg1, *arg2, *arg3;
+ void *image_file_desc;
+ void *arg5, *arg6;
+{
+ int argc;
+ char **argv;
+ char **envp;
+ int status;
+
+ lib$establish (handler);
+ decc$main (arg1, arg2, arg3, image_file_desc, arg5, arg6,
+ &argc, &argv, &envp);
+
+ status = main (argc, argv, envp);
+
+ /* Map into a range of 0 - 255. */
+ status = status & 255;
+
+ if (status > 0)
+ {
+ int save_status = status;
+
+ status = C$_EXIT1 + ((status - 1) << STS$V_MSG_NO);
+
+ /* An exit failure status requires a "severe" error
+ All status values are defined in errno with a successful
+ (1) severity but can be changed to an error (2) severity by adding 1.
+ In addition for compatibility with UNIX exit() routines we inhibit
+ a run-time error message from being generated on exit(1). */
+
+ if (save_status == 1)
+ {
+ status++;
+ status |= STS$M_INHIB_MSG;
+ }
+ }
+
+ if (status == 0)
+ status = SS$_NORMAL;
+
+ return status;
+}
+#endif
diff --git a/gcc/config/vms/vms.opt b/gcc/config/vms/vms.opt
new file mode 100644
index 00000000000..dd4b46b333e
--- /dev/null
+++ b/gcc/config/vms/vms.opt
@@ -0,0 +1,25 @@
+; Copyright (C) 2009 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/>.
+
+mmalloc64
+Target Report Mask(MALLOC64)
+Malloc data into P2 space
+
+mdebug-main=
+Target RejectNegative Joined Var(vms_debug_main)
+Set name of main routine for the debugger
diff --git a/gcc/config/vms/x-vms b/gcc/config/vms/x-vms
new file mode 100644
index 00000000000..b232c8e6804
--- /dev/null
+++ b/gcc/config/vms/x-vms
@@ -0,0 +1,27 @@
+# Copyright (C) 2001, 2002, 2004, 2005, 2008, 2009
+# 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/config/vms/xm-vms.h b/gcc/config/vms/xm-vms.h
new file mode 100644
index 00000000000..7907f9263cf
--- /dev/null
+++ b/gcc/config/vms/xm-vms.h
@@ -0,0 +1,58 @@
+/* Configuration for GCC for hosting on VMS
+ using a Unix style C library.
+ Copyright (C) 1996, 1997, 2001, 2004, 2007, 2009
+ 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)
+
+#define STANDARD_EXEC_PREFIX "/gnu/libexec/gcc/"
+#define STANDARD_STARTFILE_PREFIX "/gnu/lib/"
+#define STANDARD_INCLUDE_DIR "/gnu/include"
diff --git a/gcc/config/vms/xm-vms64.h b/gcc/config/vms/xm-vms64.h
new file mode 100644
index 00000000000..9e77f890aaa
--- /dev/null
+++ b/gcc/config/vms/xm-vms64.h
@@ -0,0 +1,23 @@
+/* Configuration for GCC for hosting on 64bit VMS
+ using a Unix style C library.
+ Copyright (C) 2009
+ 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 HOST_LONG_FORMAT "ll"
+#define HOST_PTR_PRINTF "%llp"