]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/config/nvptx/crt0.c
Update copyright years.
[thirdparty/gcc.git] / libgcc / config / nvptx / crt0.c
CommitLineData
a945c346 1/* Copyright (C) 2014-2024 Free Software Foundation, Inc.
69a6d5ad
NS
2
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.
7
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.
12
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.
16
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/>. */
21
22int *__exitval_ptr;
23
24extern void __attribute__((noreturn)) exit (int status);
25extern int main (int, void **);
26
5012919d
AM
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. */
30void *__nvptx_stacks[32] __attribute__((shared,nocommon));
31
32/* Likewise for -muniform-simt. */
33unsigned __nvptx_uni[32] __attribute__((shared,nocommon));
34
787783a0
TV
35extern void __main (int *, int, void **) __attribute__((kernel));
36
37void
69a6d5ad
NS
38__main (int *rval_ptr, int argc, void **argv)
39{
40 __exitval_ptr = rval_ptr;
41 /* Store something non-zero, so the host knows something went wrong,
42 if we fail to reach exit properly. */
43 if (rval_ptr)
44 *rval_ptr = 255;
45
5012919d
AM
46 static char stack[131072] __attribute__((aligned(8)));
47 __nvptx_stacks[0] = stack + sizeof stack;
48 __nvptx_uni[0] = 0;
49
69a6d5ad
NS
50 exit (main (argc, argv));
51}