OSDN Git Service

Set TARGET_ASM_FILE_END to file_end_indicate_exec_stack.
[pf3gnuchains/gcc-fork.git] / gcc / config / alpha / vms-psxcrt0.c
1 /* VMS crt0 returning Unix style condition codes .
2    Copyright (C) 2001 Free Software Foundation, Inc.
3    Contributed by Douglas B. Rupp (rupp@gnat.com).
4
5 This file is part of GCC.
6
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 2, or (at your option)
10 any later version.
11
12 In addition to the permissions in the GNU General Public License, the
13 Free Software Foundation gives you unlimited permission to link the
14 compiled version of this file into combinations with other programs,
15 and to distribute those combinations without any restriction coming
16 from the use of this file.  (The General Public License restrictions
17 do apply in other respects; for example, they cover modification of
18 the file, and distribution when not linked into a combine
19 executable.)
20
21 GCC is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License
27 along with GCC; see the file COPYING.  If not, write to
28 the Free Software Foundation, 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA.  */
30
31 #if !defined(__DECC)
32 You Lose! This file can only be compiled with DEC C.
33 #else
34
35 /* This file can only be compiled with DEC C, due to the call to
36    lib$establish.  */
37
38 #include <stdlib.h>
39 #include <string.h>
40 #include <ssdef.h>
41 #include <stsdef.h>
42 #include <errnodef.h>
43
44 extern void decc$main ();
45 extern int main ();
46
47 static int
48 handler (sigargs, mechargs)
49      void *sigargs;
50      void *mechargs;
51 {
52   return SS$_RESIGNAL;
53 }
54
55 int
56 __main (arg1, arg2, arg3, image_file_desc, arg5, arg6)
57      void *arg1, *arg2, *arg3;
58      void *image_file_desc;
59      void *arg5, *arg6;
60 {
61   int argc;
62   char **argv;
63   char **envp;
64   int status;
65
66   lib$establish (handler);
67   decc$main (arg1, arg2, arg3, image_file_desc, arg5, arg6,
68              &argc, &argv, &envp);
69
70   status = main (argc, argv, envp);
71
72   /* Map into a range of 0 - 255.  */
73   status = status & 255;
74
75   if (status > 0)
76     {
77       int save_status = status;
78
79       status = C$_EXIT1 + ((status - 1) << STS$V_MSG_NO);
80
81       /* An exit failure status requires a "severe" error
82          All status values are defined in errno with a successful
83          (1) severity but can be changed to an error (2) severity by adding 1.
84          In addition for compatibility with UNIX exit() routines we inhibit
85          a run-time error message from being generated on exit(1).  */
86
87       if (save_status == 1)
88         {
89           status++;
90           status |= STS$M_INHIB_MSG;
91         }
92     }
93
94   if (status == 0)
95     status = SS$_NORMAL;
96
97   return status;
98 }
99 #endif