/* Specialized bits of code needed for the offloading tables.
- Copyright (C) 2014 Free Software Foundation, Inc.
+ Copyright (C) 2014-2021 Free Software Foundation, Inc.
This file is part of GCC.
#include "tm.h"
#include "libgcc_tm.h"
+#if defined(HAVE_GAS_HIDDEN) && ENABLE_OFFLOADING == 1
+
#define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs"
#define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars"
#ifdef CRT_BEGIN
-#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
-void *__offload_func_table[0]
+const void *const __offload_func_table[0]
__attribute__ ((__used__, visibility ("hidden"),
section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
-void *__offload_var_table[0]
+const void *const __offload_var_table[0]
__attribute__ ((__used__, visibility ("hidden"),
section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
-#endif
#elif defined CRT_END
-#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
-void *__offload_funcs_end[0]
+const void *const __offload_funcs_end[0]
__attribute__ ((__used__, visibility ("hidden"),
section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
-void *__offload_vars_end[0]
+const void *const __offload_vars_end[0]
__attribute__ ((__used__, visibility ("hidden"),
section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
-extern void *__offload_func_table[];
-extern void *__offload_var_table[];
+#elif defined CRT_TABLE
-void *__OFFLOAD_TABLE__[]
+extern const void *const __offload_func_table[];
+extern const void *const __offload_var_table[];
+extern const void *const __offload_funcs_end[];
+extern const void *const __offload_vars_end[];
+
+const void *const __OFFLOAD_TABLE__[]
__attribute__ ((__visibility__ ("hidden"))) =
{
&__offload_func_table, &__offload_funcs_end,
&__offload_var_table, &__offload_vars_end
};
+
+#else /* ! CRT_BEGIN && ! CRT_END && ! CRT_TABLE */
+#error "One of CRT_BEGIN, CRT_END or CRT_TABLE must be defined."
#endif
-#else /* ! CRT_BEGIN && ! CRT_END */
-#error "One of CRT_BEGIN or CRT_END must be defined."
#endif