]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/offloadstuff.c
testsuite, rs6000: Fix builtins-6-p9-runnable.c for BE [PR114744]
[thirdparty/gcc.git] / libgcc / offloadstuff.c
CommitLineData
85c64bbe 1/* Specialized bits of code needed for the offloading tables.
a945c346 2 Copyright (C) 2014-2024 Free Software Foundation, Inc.
85c64bbe
BS
3
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
e6861a99
IV
43#if defined(HAVE_GAS_HIDDEN) && ENABLE_OFFLOADING == 1
44
85c64bbe 45#define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs"
a49c7d31 46#define OFFLOAD_IND_FUNC_TABLE_SECTION_NAME ".gnu.offload_ind_funcs"
85c64bbe
BS
47#define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars"
48
49#ifdef CRT_BEGIN
50
ebe4a560 51const void *const __offload_func_table[0]
85c64bbe
BS
52 __attribute__ ((__used__, visibility ("hidden"),
53 section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
ebe4a560 54const void *const __offload_var_table[0]
85c64bbe
BS
55 __attribute__ ((__used__, visibility ("hidden"),
56 section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
a49c7d31
KCY
57const void *const __offload_ind_func_table[0]
58 __attribute__ ((__used__, visibility ("hidden"),
59 section (OFFLOAD_IND_FUNC_TABLE_SECTION_NAME))) = { };
85c64bbe
BS
60
61#elif defined CRT_END
62
ebe4a560 63const void *const __offload_funcs_end[0]
85c64bbe
BS
64 __attribute__ ((__used__, visibility ("hidden"),
65 section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
ebe4a560 66const void *const __offload_vars_end[0]
85c64bbe
BS
67 __attribute__ ((__used__, visibility ("hidden"),
68 section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
a49c7d31
KCY
69const void *const __offload_ind_funcs_end[0]
70 __attribute__ ((__used__, visibility ("hidden"),
71 section (OFFLOAD_IND_FUNC_TABLE_SECTION_NAME))) = { };
85c64bbe 72
e6861a99
IV
73#elif defined CRT_TABLE
74
ebe4a560
NS
75extern const void *const __offload_func_table[];
76extern const void *const __offload_var_table[];
a49c7d31 77extern const void *const __offload_ind_func_table[];
e6861a99
IV
78extern const void *const __offload_funcs_end[];
79extern const void *const __offload_vars_end[];
a49c7d31 80extern const void *const __offload_ind_funcs_end[];
85c64bbe 81
ebe4a560 82const void *const __OFFLOAD_TABLE__[]
85c64bbe
BS
83 __attribute__ ((__visibility__ ("hidden"))) =
84{
85 &__offload_func_table, &__offload_funcs_end,
a49c7d31
KCY
86 &__offload_var_table, &__offload_vars_end,
87 &__offload_ind_func_table, &__offload_ind_funcs_end,
85c64bbe 88};
e6861a99
IV
89
90#else /* ! CRT_BEGIN && ! CRT_END && ! CRT_TABLE */
91#error "One of CRT_BEGIN, CRT_END or CRT_TABLE must be defined."
85c64bbe
BS
92#endif
93
85c64bbe 94#endif