blob: 57e0973288a70ebc1ca6259507894d3b705f3765 [file] [log] [blame]
Bernd Schmidt85c64bb2014-11-13 13:28:56 +00001/* Specialized bits of code needed for the offloading tables.
Jakub Jelinek5624e562015-01-05 13:33:28 +01002 Copyright (C) 2014-2015 Free Software Foundation, Inc.
Bernd Schmidt85c64bb2014-11-13 13:28:56 +00003
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16Under Section 7 of GPL version 3, you are granted additional
17permissions described in the GCC Runtime Library Exception, version
183.1, as published by the Free Software Foundation.
19
20You should have received a copy of the GNU General Public License and
21a copy of the GCC Runtime Library Exception along with this program;
22see 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
43#define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs"
44#define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars"
45
46#ifdef CRT_BEGIN
47
48#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
Nathan Sidwellebe4a562015-07-17 17:12:01 +000049const void *const __offload_func_table[0]
Bernd Schmidt85c64bb2014-11-13 13:28:56 +000050 __attribute__ ((__used__, visibility ("hidden"),
51 section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
Nathan Sidwellebe4a562015-07-17 17:12:01 +000052const void *const __offload_var_table[0]
Bernd Schmidt85c64bb2014-11-13 13:28:56 +000053 __attribute__ ((__used__, visibility ("hidden"),
54 section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
55#endif
56
57#elif defined CRT_END
58
59#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
Nathan Sidwellebe4a562015-07-17 17:12:01 +000060const void *const __offload_funcs_end[0]
Bernd Schmidt85c64bb2014-11-13 13:28:56 +000061 __attribute__ ((__used__, visibility ("hidden"),
62 section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
Nathan Sidwellebe4a562015-07-17 17:12:01 +000063const void *const __offload_vars_end[0]
Bernd Schmidt85c64bb2014-11-13 13:28:56 +000064 __attribute__ ((__used__, visibility ("hidden"),
65 section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
66
Nathan Sidwellebe4a562015-07-17 17:12:01 +000067extern const void *const __offload_func_table[];
68extern const void *const __offload_var_table[];
Bernd Schmidt85c64bb2014-11-13 13:28:56 +000069
Nathan Sidwellebe4a562015-07-17 17:12:01 +000070const void *const __OFFLOAD_TABLE__[]
Bernd Schmidt85c64bb2014-11-13 13:28:56 +000071 __attribute__ ((__visibility__ ("hidden"))) =
72{
73 &__offload_func_table, &__offload_funcs_end,
74 &__offload_var_table, &__offload_vars_end
75};
76#endif
77
78#else /* ! CRT_BEGIN && ! CRT_END */
79#error "One of CRT_BEGIN or CRT_END must be defined."
80#endif