diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3809bd537e..be8e7b46f14 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ Fri Dec 14 07:29:52 2001 Douglas B. Rupp + * config.gcc (alpha64-dec-*vms*): New case. + * config/alpha/t-vms64, config/alpha/vms-crt0-64.c: New files. + * config/alpha/vms-psxcrt0-64.c, config/alpha/vms64.h: Likewise. + * config/alpha/xm-vms64.h: Likewise. + * config/alpha/alpha.c (vms_attribute_table): Add new attributes. (alpha_write_linkage): Test for null alpha_links. (SECTION_VMS_GLOBAL, SECTION_VMS_INITIALIZE): New section attributes. diff --git a/gcc/config.gcc b/gcc/config.gcc index ab253615cc2..a98b7d51f8a 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -519,6 +519,23 @@ alpha*-*-vxworks*) use_collect2=yes thread_file='vxworks' ;; +alpha64-dec-*vms*) + xm_defines=POSIX + tm_file="alpha/vms.h alpha/vms64.h" + xm_file="alpha/xm-vms.h alpha/xm-vms64.h" + tmake_file="alpha/t-alpha alpha/t-vms alpha/t-vms64 alpha/t-ieee" + xmake_file=alpha/x-vms + exeext=.exe + # This removes the cpu type and manufacturer components and + # replaces "." with "_" in the operating system version. + case $host in *-*-*vms*) + target_alias=`echo $host \ + | sed 's/.*-.*-\(.*\)$/\1/' | sed 's/\./_/g'` + ;; + esac + prefix=/gnu + local_prefix=/gnu + ;; alpha*-dec-*vms*) xm_defines=POSIX tm_file=alpha/vms.h diff --git a/gcc/config/alpha/t-vms64 b/gcc/config/alpha/t-vms64 new file mode 100644 index 00000000000..e3fc3be6435 --- /dev/null +++ b/gcc/config/alpha/t-vms64 @@ -0,0 +1,8 @@ +# Assemble startup files. +vcrt0.o: $(CRT0_S) $(GCC_PASSES) + decc -c /names=as_is /pointer_size=64 \ + $(srcdir)/config/alpha/vms-crt0-64.c -o vcrt0.o + +pcrt0.o: $(CRT0_S) $(GCC_PASSES) + decc -c /names=as_is /pointer_size=64 \ + $(srcdir)/config/alpha/vms-psxcrt0-64.c -o pcrt0.o diff --git a/gcc/config/alpha/vms-crt0-64.c b/gcc/config/alpha/vms-crt0-64.c new file mode 100644 index 00000000000..4120a6b4c0f --- /dev/null +++ b/gcc/config/alpha/vms-crt0-64.c @@ -0,0 +1,99 @@ +/* VMS 64bit crt0 returning VMS style condition codes . + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Douglas B. Rupp (rupp@gnat.com). + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#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 the the call to + lib$establish and the pragmas pointer_size. */ + +#pragma __pointer_size short + +#include +#include +#include + +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 **) malloc (sizeof (char *) * (argc + 1)); + + for (i = 0; i < argc; i++) + long_argv[i] = strdup (argv[i]); + + long_argv[argc] = (char *) 0; + + long_envp = (char **) malloc (sizeof (char *) * 5); + + for (i = 0; envp[i]; i++) + long_envp[i] = strdup (envp[i]); + + long_envp[i] = (char *) 0; + +#pragma __pointer_size short + + return main (argc, long_argv, long_envp); +} +#endif diff --git a/gcc/config/alpha/vms-psxcrt0-64.c b/gcc/config/alpha/vms-psxcrt0-64.c new file mode 100644 index 00000000000..be3e70d6414 --- /dev/null +++ b/gcc/config/alpha/vms-psxcrt0-64.c @@ -0,0 +1,128 @@ +/* VMS 64bit crt0 returning Unix style condition codes . + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Douglas B. Rupp (rupp@gnat.com). + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#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 the the call to + lib$establish and the pragmas pointer_size. */ + +#pragma __pointer_size short + +#include +#include +#include +#include +#include + +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 **) malloc (sizeof (char *) * (argc + 1)); + + for (i = 0; i < argc; i++) + long_argv[i] = strdup (argv[i]); + + long_argv[argc] = (char *) 0; + + long_envp = (char **) malloc (sizeof (char *) * 5); + + for (i = 0; envp[i]; i++) + long_envp[i] = strdup (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/alpha/vms64.h b/gcc/config/alpha/vms64.h new file mode 100644 index 00000000000..3b4f5874669 --- /dev/null +++ b/gcc/config/alpha/vms64.h @@ -0,0 +1,32 @@ +/* Output variables, constants and external declarations, for GNU compiler. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Douglas Rupp (rupp@gnat.com). + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Defaults to BITS_PER_WORD, e.g. 64 which is what is wanted. + This is incompatible with DEC C, but matches DEC Ada */ +#undef LONG_TYPE_SIZE + +/* Defaults to "long int" */ +#undef SIZE_TYPE +#undef PTRDIFF_TYPE + +#undef POINTERS_EXTEND_UNSIGNED +#undef POINTER_SIZE +#define POINTER_SIZE 64 diff --git a/gcc/config/alpha/xm-vms64.h b/gcc/config/alpha/xm-vms64.h new file mode 100644 index 00000000000..26fd82923a4 --- /dev/null +++ b/gcc/config/alpha/xm-vms64.h @@ -0,0 +1,29 @@ +/* Configuration for GNU C-compiler for openVMS/Alpha. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Douglas Rupp (rupp@gnat.com). + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#undef HOST_WIDE_INT + +/* Since DEC C long != Gnu C long */ +#define HOST_PTR_PRINTF "%llx" +#define HOST_WIDE_INT_PRINT_DEC "%lld" +#define HOST_WIDE_INT_PRINT_UNSIGNED "%llu" +#define HOST_WIDE_INT_PRINT_HEX "0x%llx" +#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"