Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 1 | /* Specialized bits of code needed for the offloading tables. |
Thomas Koenig | b18a97e | 2021-09-13 19:49:49 +0200 | [diff] [blame] | 2 | Copyright (C) 2014-2021 Free Software Foundation, Inc. |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 3 | |
| 4 | This file is part of GCC. |
| 5 | |
| 6 | GCC is free software; you can redistribute it and/or modify it under |
| 7 | the terms of the GNU General Public License as published by the Free |
| 8 | Software Foundation; either version 3, or (at your option) any later |
| 9 | version. |
| 10 | |
| 11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | for more details. |
| 15 | |
| 16 | Under Section 7 of GPL version 3, you are granted additional |
| 17 | permissions described in the GCC Runtime Library Exception, version |
| 18 | 3.1, as published by the Free Software Foundation. |
| 19 | |
| 20 | You should have received a copy of the GNU General Public License and |
| 21 | a copy of the GCC Runtime Library Exception along with this program; |
| 22 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 23 | <http://www.gnu.org/licenses/>. */ |
| 24 | |
| 25 | /* Target machine header files require this define. */ |
| 26 | #define IN_LIBGCC2 |
| 27 | |
| 28 | /* FIXME: Including auto-host is incorrect, but until we have |
| 29 | identified the set of defines that need to go into auto-target.h, |
| 30 | this will have to do. */ |
| 31 | #include "auto-host.h" |
| 32 | #undef caddr_t |
| 33 | #undef pid_t |
| 34 | #undef rlim_t |
| 35 | #undef ssize_t |
| 36 | #undef vfork |
| 37 | #include "tconfig.h" |
| 38 | #include "tsystem.h" |
| 39 | #include "coretypes.h" |
| 40 | #include "tm.h" |
| 41 | #include "libgcc_tm.h" |
| 42 | |
Ilya Verbin | e6861a9 | 2016-02-25 12:23:52 +0000 | [diff] [blame] | 43 | #if defined(HAVE_GAS_HIDDEN) && ENABLE_OFFLOADING == 1 |
| 44 | |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 45 | #define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs" |
| 46 | #define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars" |
| 47 | |
| 48 | #ifdef CRT_BEGIN |
| 49 | |
Nathan Sidwell | ebe4a56 | 2015-07-17 17:12:01 +0000 | [diff] [blame] | 50 | const void *const __offload_func_table[0] |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 51 | __attribute__ ((__used__, visibility ("hidden"), |
| 52 | section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { }; |
Nathan Sidwell | ebe4a56 | 2015-07-17 17:12:01 +0000 | [diff] [blame] | 53 | const void *const __offload_var_table[0] |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 54 | __attribute__ ((__used__, visibility ("hidden"), |
| 55 | section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { }; |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 56 | |
| 57 | #elif defined CRT_END |
| 58 | |
Nathan Sidwell | ebe4a56 | 2015-07-17 17:12:01 +0000 | [diff] [blame] | 59 | const void *const __offload_funcs_end[0] |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 60 | __attribute__ ((__used__, visibility ("hidden"), |
| 61 | section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { }; |
Nathan Sidwell | ebe4a56 | 2015-07-17 17:12:01 +0000 | [diff] [blame] | 62 | const void *const __offload_vars_end[0] |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 63 | __attribute__ ((__used__, visibility ("hidden"), |
| 64 | section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { }; |
| 65 | |
Ilya Verbin | e6861a9 | 2016-02-25 12:23:52 +0000 | [diff] [blame] | 66 | #elif defined CRT_TABLE |
| 67 | |
Nathan Sidwell | ebe4a56 | 2015-07-17 17:12:01 +0000 | [diff] [blame] | 68 | extern const void *const __offload_func_table[]; |
| 69 | extern const void *const __offload_var_table[]; |
Ilya Verbin | e6861a9 | 2016-02-25 12:23:52 +0000 | [diff] [blame] | 70 | extern const void *const __offload_funcs_end[]; |
| 71 | extern const void *const __offload_vars_end[]; |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 72 | |
Nathan Sidwell | ebe4a56 | 2015-07-17 17:12:01 +0000 | [diff] [blame] | 73 | const void *const __OFFLOAD_TABLE__[] |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 74 | __attribute__ ((__visibility__ ("hidden"))) = |
| 75 | { |
| 76 | &__offload_func_table, &__offload_funcs_end, |
| 77 | &__offload_var_table, &__offload_vars_end |
| 78 | }; |
Ilya Verbin | e6861a9 | 2016-02-25 12:23:52 +0000 | [diff] [blame] | 79 | |
| 80 | #else /* ! CRT_BEGIN && ! CRT_END && ! CRT_TABLE */ |
| 81 | #error "One of CRT_BEGIN, CRT_END or CRT_TABLE must be defined." |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 82 | #endif |
| 83 | |
Bernd Schmidt | 85c64bb | 2014-11-13 13:28:56 +0000 | [diff] [blame] | 84 | #endif |