summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2015-07-17 17:12:01 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2015-07-17 17:12:01 +0000
commitebe4a560737e72aa508af4c0d9e1ac6e84a97655 (patch)
tree0620634b02bd3dbd3f65141af8fbb850d2590361
parent247577525613274ed246537f195eda285087d814 (diff)
downloadgcc-ebe4a560737e72aa508af4c0d9e1ac6e84a97655.tar.gz
mkoffload.c (process): Constify host data.
gcc/ * config/nvptx/mkoffload.c (process): Constify host data. * config/i386/intelmic-mkoffload.c (generate_target_descr_file): Constify host data. (generate_host_descr_file): Likewise. libgomp/ * target.c (struct_offload_image_descr): Constify host_table. (gomp_offload_image_to_device): Likewise. (GOMP_offload_register, GOMP_offload_unregister): Likewise. libgcc/ * offloadstuff.c: Constify host data. From-SVN: r225943
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/intelmic-mkoffload.c6
-rw-r--r--gcc/config/nvptx/mkoffload.c4
-rw-r--r--libgcc/ChangeLog4
-rw-r--r--libgcc/offloadstuff.c14
-rw-r--r--libgomp/ChangeLog4
-rw-r--r--libgomp/target.c10
7 files changed, 33 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ca10a807c34..8ef4de4a230 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-07-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * config/nvptx/mkoffload.c (process): Constify host data.
+ * config/i386/intelmic-mkoffload.c (generate_target_descr_file):
+ Constify host data.
+ (generate_host_descr_file): Likewise.
+
2015-07-17 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
diff --git a/gcc/config/i386/intelmic-mkoffload.c b/gcc/config/i386/intelmic-mkoffload.c
index a3b0a5cc1ac..ca15868dde1 100644
--- a/gcc/config/i386/intelmic-mkoffload.c
+++ b/gcc/config/i386/intelmic-mkoffload.c
@@ -338,7 +338,7 @@ generate_host_descr_file (const char *host_compiler)
fatal_error (input_location, "cannot open '%s'", src_filename);
fprintf (src_file,
- "extern void *__OFFLOAD_TABLE__;\n"
+ "extern const void *const __OFFLOAD_TABLE__;\n"
"extern const void *const __offload_image_intelmic_start;\n"
"extern const void *const __offload_image_intelmic_end;\n\n"
@@ -350,11 +350,11 @@ generate_host_descr_file (const char *host_compiler)
"#ifdef __cplusplus\n"
"extern \"C\"\n"
"#endif\n"
- "void GOMP_offload_register (void *, int, const void *);\n"
+ "void GOMP_offload_register (const void *, int, const void *);\n"
"#ifdef __cplusplus\n"
"extern \"C\"\n"
"#endif\n"
- "void GOMP_offload_unregister (void *, int, const void *);\n\n"
+ "void GOMP_offload_unregister (const void *, int, const void *);\n\n"
"__attribute__((constructor))\n"
"static void\n"
diff --git a/gcc/config/nvptx/mkoffload.c b/gcc/config/nvptx/mkoffload.c
index 52f8bd91144..ab381799909 100644
--- a/gcc/config/nvptx/mkoffload.c
+++ b/gcc/config/nvptx/mkoffload.c
@@ -881,12 +881,12 @@ process (FILE *in, FILE *out)
"extern \"C\" {\n"
"#endif\n");
fprintf (out, "extern void GOMP_offload_register"
- " (void *, int, const void *);\n");
+ " (const void *, int, const void *);\n");
fprintf (out, "#ifdef __cplusplus\n"
"}\n"
"#endif\n");
- fprintf (out, "extern void *__OFFLOAD_TABLE__[];\n\n");
+ fprintf (out, "extern const void *const __OFFLOAD_TABLE__[];\n\n");
fprintf (out, "static __attribute__((constructor)) void init (void)\n{\n");
fprintf (out, " GOMP_offload_register (__OFFLOAD_TABLE__, %d,\n",
GOMP_DEVICE_NVIDIA_PTX);
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index ac1fbb75be6..4bd9f1fd9d5 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,7 @@
+2015-07-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * offloadstuff.c: Constify host data.
+
2015-07-17 Jan Beulich <jbeulich@suse.com>
* config/t-softfp: Split up "else ifneq".
diff --git a/libgcc/offloadstuff.c b/libgcc/offloadstuff.c
index 0d6ef2336b4..57e0973288a 100644
--- a/libgcc/offloadstuff.c
+++ b/libgcc/offloadstuff.c
@@ -46,10 +46,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#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
@@ -57,17 +57,17 @@ void *__offload_var_table[0]
#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[];
+extern const void *const __offload_func_table[];
+extern const void *const __offload_var_table[];
-void *__OFFLOAD_TABLE__[]
+const void *const __OFFLOAD_TABLE__[]
__attribute__ ((__visibility__ ("hidden"))) =
{
&__offload_func_table, &__offload_funcs_end,
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 129e78b7df9..9810a183737 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,9 @@
2015-07-17 Nathan Sidwell <nathan@codesourcery.com>
+ * target.c (struct_offload_image_descr): Constify host_table.
+ (gomp_offload_image_to_device): Likewise.
+ (GOMP_offload_register, GOMP_offload_unregister): Likewise.
+
* libgomp.h (gomp_device_descr): Constify target data arguments.
* target.c (struct offload_image_descr): Constify target_data.
(gomp_offload_image_to_device): Likewise.
diff --git a/libgomp/target.c b/libgomp/target.c
index b11c4f2fa6c..ca536a048d3 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -57,7 +57,7 @@ static gomp_mutex_t register_lock;
pointer to target data. */
struct offload_image_descr {
enum offload_target_type type;
- void *host_table;
+ const void *host_table;
const void *target_data;
};
@@ -642,7 +642,7 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum, void **hostaddrs,
static void
gomp_offload_image_to_device (struct gomp_device_descr *devicep,
- void *host_table, const void *target_data,
+ const void *host_table, const void *target_data,
bool is_register_lock)
{
void **host_func_table = ((void ***) host_table)[0];
@@ -730,7 +730,8 @@ gomp_offload_image_to_device (struct gomp_device_descr *devicep,
the target, and TARGET_DATA needed by target plugin. */
void
-GOMP_offload_register (void *host_table, enum offload_target_type target_type,
+GOMP_offload_register (const void *host_table,
+ enum offload_target_type target_type,
const void *target_data)
{
int i;
@@ -764,7 +765,8 @@ GOMP_offload_register (void *host_table, enum offload_target_type target_type,
the target, and TARGET_DATA needed by target plugin. */
void
-GOMP_offload_unregister (void *host_table, enum offload_target_type target_type,
+GOMP_offload_unregister (const void *host_table,
+ enum offload_target_type target_type,
const void *target_data)
{
void **host_func_table = ((void ***) host_table)[0];