xref: /netbsd-src/external/gpl3/gcc.old/dist/libgcc/offloadstuff.c (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg /* Specialized bits of code needed for the offloading tables.
2*8feb0f0bSmrg    Copyright (C) 2014-2020 Free Software Foundation, Inc.
31debfc3dSmrg 
41debfc3dSmrg This file is part of GCC.
51debfc3dSmrg 
61debfc3dSmrg GCC is free software; you can redistribute it and/or modify it under
71debfc3dSmrg the terms of the GNU General Public License as published by the Free
81debfc3dSmrg Software Foundation; either version 3, or (at your option) any later
91debfc3dSmrg version.
101debfc3dSmrg 
111debfc3dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
121debfc3dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
131debfc3dSmrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
141debfc3dSmrg for more details.
151debfc3dSmrg 
161debfc3dSmrg Under Section 7 of GPL version 3, you are granted additional
171debfc3dSmrg permissions described in the GCC Runtime Library Exception, version
181debfc3dSmrg 3.1, as published by the Free Software Foundation.
191debfc3dSmrg 
201debfc3dSmrg You should have received a copy of the GNU General Public License and
211debfc3dSmrg a copy of the GCC Runtime Library Exception along with this program;
221debfc3dSmrg see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
231debfc3dSmrg <http://www.gnu.org/licenses/>.  */
241debfc3dSmrg 
251debfc3dSmrg /* Target machine header files require this define. */
261debfc3dSmrg #define IN_LIBGCC2
271debfc3dSmrg 
281debfc3dSmrg /* FIXME: Including auto-host is incorrect, but until we have
291debfc3dSmrg    identified the set of defines that need to go into auto-target.h,
301debfc3dSmrg    this will have to do.  */
311debfc3dSmrg #include "auto-host.h"
321debfc3dSmrg #undef caddr_t
331debfc3dSmrg #undef pid_t
341debfc3dSmrg #undef rlim_t
351debfc3dSmrg #undef ssize_t
361debfc3dSmrg #undef vfork
371debfc3dSmrg #include "tconfig.h"
381debfc3dSmrg #include "tsystem.h"
391debfc3dSmrg #include "coretypes.h"
401debfc3dSmrg #include "tm.h"
411debfc3dSmrg #include "libgcc_tm.h"
421debfc3dSmrg 
431debfc3dSmrg #if defined(HAVE_GAS_HIDDEN) && ENABLE_OFFLOADING == 1
441debfc3dSmrg 
451debfc3dSmrg #define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs"
461debfc3dSmrg #define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars"
471debfc3dSmrg 
481debfc3dSmrg #ifdef CRT_BEGIN
491debfc3dSmrg 
501debfc3dSmrg const void *const __offload_func_table[0]
511debfc3dSmrg   __attribute__ ((__used__, visibility ("hidden"),
521debfc3dSmrg 		  section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
531debfc3dSmrg const void *const __offload_var_table[0]
541debfc3dSmrg   __attribute__ ((__used__, visibility ("hidden"),
551debfc3dSmrg 		  section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
561debfc3dSmrg 
571debfc3dSmrg #elif defined CRT_END
581debfc3dSmrg 
591debfc3dSmrg const void *const __offload_funcs_end[0]
601debfc3dSmrg   __attribute__ ((__used__, visibility ("hidden"),
611debfc3dSmrg 		  section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
621debfc3dSmrg const void *const __offload_vars_end[0]
631debfc3dSmrg   __attribute__ ((__used__, visibility ("hidden"),
641debfc3dSmrg 		  section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
651debfc3dSmrg 
661debfc3dSmrg #elif defined CRT_TABLE
671debfc3dSmrg 
681debfc3dSmrg extern const void *const __offload_func_table[];
691debfc3dSmrg extern const void *const __offload_var_table[];
701debfc3dSmrg extern const void *const __offload_funcs_end[];
711debfc3dSmrg extern const void *const __offload_vars_end[];
721debfc3dSmrg 
731debfc3dSmrg const void *const __OFFLOAD_TABLE__[]
741debfc3dSmrg   __attribute__ ((__visibility__ ("hidden"))) =
751debfc3dSmrg {
761debfc3dSmrg   &__offload_func_table, &__offload_funcs_end,
771debfc3dSmrg   &__offload_var_table, &__offload_vars_end
781debfc3dSmrg };
791debfc3dSmrg 
801debfc3dSmrg #else /* ! CRT_BEGIN && ! CRT_END && ! CRT_TABLE  */
811debfc3dSmrg #error "One of CRT_BEGIN, CRT_END or CRT_TABLE must be defined."
821debfc3dSmrg #endif
831debfc3dSmrg 
841debfc3dSmrg #endif
85