1 /* VMS 64bit crt0 returning Unix style condition codes .
2 Copyright (C) 2001, 2009 Free Software Foundation, Inc.
3 Contributed by Douglas B. Rupp (rupp@gnat.com).
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
27 You Lose! This file can only be compiled with DEC C.
30 /* This file can only be compiled with DEC C, due to the call to
31 lib$establish and the pragmas pointer_size. */
33 #pragma __pointer_size short
41 extern void decc$main ();
45 handler (sigargs, mechargs)
53 __main (arg1, arg2, arg3, image_file_desc, arg5, arg6)
54 void *arg1, *arg2, *arg3;
55 void *image_file_desc;
62 #pragma __pointer_size long
69 #pragma __pointer_size short
71 lib$establish (handler);
72 decc$main (arg1, arg2, arg3, image_file_desc,
73 arg5, arg6, &argc, &argv, &envp);
75 #pragma __pointer_size long
77 /* Reallocate argv with 64 bit pointers. */
78 long_argv = (char **) _malloc32 (sizeof (char *) * (argc + 1));
80 for (i = 0; i < argc; i++)
81 long_argv[i] = (char *) _strdup32 (argv[i]);
83 long_argv[argc] = (char *) 0;
85 for (i = 0; envp[i]; i++);
86 long_envp = (char **) _malloc32 (sizeof (char *) * (i + 1));
88 for (i = 0; envp[i]; i++)
89 long_envp[i] = (char *) _strdup32 (envp[i]);
91 long_envp[i] = (char *) 0;
93 #pragma __pointer_size short
95 status = main (argc, long_argv, long_envp);
97 /* Map into a range of 0 - 255. */
98 status = status & 255;
102 int save_status = status;
104 status = C$_EXIT1 + ((status - 1) << STS$V_MSG_NO);
106 /* An exit failure status requires a "severe" error. All status values
107 are defined in errno with a successful (1) severity but can be
108 changed to an error (2) severity by adding 1. In addition for
109 compatibility with UNIX exit() routines we inhibit a run-time error
110 message from being generated on exit(1). */
112 if (save_status == 1)
115 status |= STS$M_INHIB_MSG;