ada: Reference to nonexistent operator in reduction expression accepted
[official-gcc.git] / libgcc / config / nvptx / crt0.c
blob47e8ec44c19ba7976935b33a600afce7aa8ddcda
1 /* Copyright (C) 2014-2024 Free Software Foundation, Inc.
3 This file is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 3, or (at your option) any
6 later version.
8 This file is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 Under Section 7 of GPL version 3, you are granted additional
14 permissions described in the GCC Runtime Library Exception, version
15 3.1, as published by the Free Software Foundation.
17 You should have received a copy of the GNU General Public License and
18 a copy of the GCC Runtime Library Exception along with this program;
19 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
20 <http://www.gnu.org/licenses/>. */
22 int *__exitval_ptr;
24 extern void __attribute__((noreturn)) exit (int status);
25 extern int main (int, void **);
27 /* Always setup soft stacks to allow testing with -msoft-stack but without
28 -mgomp. 32 is the maximum number of warps in a CTA: the definition here
29 must match the external declaration emitted by the compiler. */
30 void *__nvptx_stacks[32] __attribute__((shared,nocommon));
32 /* Likewise for -muniform-simt. */
33 unsigned __nvptx_uni[32] __attribute__((shared,nocommon));
35 /* Global constructor/destructor support. Dummy; if necessary, overridden via
36 'gbl-ctors.c'. */
38 extern void __gbl_ctors (void);
40 void __attribute__((weak))
41 __gbl_ctors (void)
45 extern void __main (int *, int, void **) __attribute__((kernel));
47 void
48 __main (int *rval_ptr, int argc, void **argv)
50 __exitval_ptr = rval_ptr;
51 /* Store something non-zero, so the host knows something went wrong,
52 if we fail to reach exit properly. */
53 if (rval_ptr)
54 *rval_ptr = 255;
56 static char stack[131072] __attribute__((aligned(8)));
57 __nvptx_stacks[0] = stack + sizeof stack;
58 __nvptx_uni[0] = 0;
60 __gbl_ctors ();
62 exit (main (argc, argv));