Fixes seg fault when using -fopt-info with AutoFDO LIPO. Ensure that the
mapping between module name and ident is setup.

Tested with regression tests and internal benchmarks. Ok for google/4_9

2014-08-23  Teresa Johnson  <tejohn...@google.com>

        Google ref b/17124135
        * auto-profile.c (read_aux_modules): Record the module name/ident pair.
        * coverage.c (record_module_name): Make non-static.
        * l-ipo.h (record_module_name): Ditto.

Index: auto-profile.c
===================================================================
--- auto-profile.c      (revision 214320)
+++ auto-profile.c      (working copy)
@@ -958,6 +958,7 @@ read_aux_modules (void)
   module_infos = XCNEWVEC (gcov_module_info *, num_aux_modules + 1);
   module_infos[0] = module;
   primary_module_id = module->ident;
+  record_module_name (module->ident, lbasename (in_fnames[0]));
   if (aux_modules == NULL)
     return;
   unsigned curr_module = 1, max_group = PARAM_VALUE (PARAM_MAX_LIPO_GROUP);
@@ -1004,6 +1005,7 @@ read_aux_modules (void)
        }
       module_infos[curr_module++] = aux_module;
       add_input_filename (*iter);
+      record_module_name (aux_module->ident, lbasename (*iter));
     }
 }

Index: coverage.c
===================================================================
--- coverage.c  (revision 214320)
+++ coverage.c  (working copy)
@@ -658,7 +658,7 @@ typedef struct {

 static vec<mod_id_to_name_t> *mod_names;

-static void
+void
 record_module_name (unsigned int mod_id, const char *name)
 {
   mod_id_to_name_t t;
Index: l-ipo.h
===================================================================
--- l-ipo.h     (revision 214320)
+++ l-ipo.h     (working copy)
@@ -63,6 +63,7 @@ int equivalent_struct_types_for_tbaa (const_tree t
 void lipo_link_and_fixup (void);
 extern void copy_defined_module_set (tree, tree);
 extern bool is_parsing_done_p (void);
+extern void record_module_name (unsigned int, const char *);
 extern const char* get_module_name (unsigned int);

 #endif

-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413

Reply via email to