]>
Commit | Line | Data |
---|---|---|
a5544970 | 1 | /* Copyright (C) 2014-2019 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 | ||
22 | int *__exitval_ptr; | |
23 | ||
24 | extern void __attribute__((noreturn)) exit (int status); | |
25 | extern 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. */ | |
30 | void *__nvptx_stacks[32] __attribute__((shared,nocommon)); | |
31 | ||
32 | /* Likewise for -muniform-simt. */ | |
33 | unsigned __nvptx_uni[32] __attribute__((shared,nocommon)); | |
34 | ||
69a6d5ad NS |
35 | void __attribute__((kernel)) |
36 | __main (int *rval_ptr, int argc, void **argv) | |
37 | { | |
38 | __exitval_ptr = rval_ptr; | |
39 | /* Store something non-zero, so the host knows something went wrong, | |
40 | if we fail to reach exit properly. */ | |
41 | if (rval_ptr) | |
42 | *rval_ptr = 255; | |
43 | ||
5012919d AM |
44 | static char stack[131072] __attribute__((aligned(8))); |
45 | __nvptx_stacks[0] = stack + sizeof stack; | |
46 | __nvptx_uni[0] = 0; | |
47 | ||
69a6d5ad NS |
48 | exit (main (argc, argv)); |
49 | } |