This makes us read in the offloaded functions in an offload compiler's
lto1. This is essentially Michael Zolotukhin's patch 1/3 from a while ago.
Committed on gomp-4_0-branch.
Bernd
Index: gcc/lto/ChangeLog
===================================================================
--- gcc/lto/ChangeLog (revision 208720)
+++ gcc/lto/ChangeLog (working copy)
@@ -1,5 +1,11 @@
2014-03-20 Bernd Schmidt <ber...@codesourcery.com>
+ From Michael Zolotukhin.
+ * lto-object.c (lto_obj_add_section): Compare against the
+ section_name_prefix variable.
+ * lto.c (lto_section_with_id): Likewise.
+ (read_cgraph_and_symbols): Change it if ACCEL_COMPILER.
+
* lto-object.c: Include "lto-section-names.h".
(LTO_SEGMENT_NAME): Don't define.
* lto.c: Include "lto-section-names.h".
Index: gcc/lto/lto-object.c
===================================================================
--- gcc/lto/lto-object.c (revision 208720)
+++ gcc/lto/lto-object.c (working copy)
@@ -230,8 +230,7 @@ lto_obj_add_section (void *data, const c
void **slot;
struct lto_section_list *list = loasd->list;
- if (strncmp (name, LTO_SECTION_NAME_PREFIX,
- strlen (LTO_SECTION_NAME_PREFIX)) != 0)
+ if (strncmp (name, section_name_prefix, strlen (section_name_prefix)))
return 1;
new_name = xstrdup (name);
Index: gcc/lto/lto.c
===================================================================
--- gcc/lto/lto.c (revision 208720)
+++ gcc/lto/lto.c (working copy)
@@ -2128,7 +2128,7 @@ lto_section_with_id (const char *name, u
{
const char *s;
- if (strncmp (name, LTO_SECTION_NAME_PREFIX, strlen (LTO_SECTION_NAME_PREFIX)))
+ if (strncmp (name, section_name_prefix, strlen (section_name_prefix)))
return 0;
s = strrchr (name, '.');
return s && sscanf (s, "." HOST_WIDE_INT_PRINT_HEX_PURE, id) == 1;
@@ -2903,6 +2903,10 @@ read_cgraph_and_symbols (unsigned nfiles
timevar_push (TV_IPA_LTO_DECL_IN);
+#ifdef ACCEL_COMPILER
+ section_name_prefix = OMP_SECTION_NAME_PREFIX;
+#endif
+
real_file_decl_data
= decl_data = ggc_alloc_cleared_vec_lto_file_decl_data_ptr (nfiles + 1);
real_file_count = nfiles;