first/weak_global_object_name are part of the global state. This seems to be used to produce the assembler names. They are set only once as early as possible in the parsing; thus we should define it to be whatever it was in the first pph (or even in the C file if it was set before any pph was even loaded.
I'm not sure exactly what this does, but trying to find a fix for the asm diffs this is the first thing that I hit in the compiler logic that was different in the good compiler vs the pph compiler. With this fix this bit of logic is now correct. However, this doesn't fix any pph test (nor does it even change any pph asm (I diff'ed the old bad assemblies (*.s+pph) with the new ones)). Tested with bootstrap build and pph regression testing. 2011-06-30 Gabriel Charette <gch...@google.com> * Make-lang.in (pph-streamer-out.o): Add dependence on output.h (pph-streamer-in.o): Add dependence on output.h * pph-streamer-in.c (pph_read_file_contents): Stream in first_global_object_name and weak_global_object_name. * gcc/cp/pph-streamer-out.c (pph_write_file_contents): Stream out first_global_object_name and weak_global_object_name. diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 0bb1a15..ec7596a 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -350,8 +350,8 @@ cp/pph-streamer.o: cp/pph-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ cp/pph-streamer-out.o: cp/pph-streamer-out.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) tree-pretty-print.h $(LTO_STREAMER_H) \ $(CXX_PPH_STREAMER_H) $(CXX_PPH_H) $(TREE_PASS_H) version.h \ - cppbuiltin.h tree-iterator.h + cppbuiltin.h tree-iterator.h output.h cp/pph-streamer-in.o: cp/pph-streamer-in.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) tree-pretty-print.h $(LTO_STREAMER_H) \ $(CXX_PPH_STREAMER_H) $(CXX_PPH_H) $(TREE_PASS_H) version.h \ - cppbuiltin.h tree-iterator.h + cppbuiltin.h tree-iterator.h output.h diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c index 3ac5243..c341d50 100644 --- a/gcc/cp/pph-streamer-in.c +++ b/gcc/cp/pph-streamer-in.c @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "version.h" #include "cppbuiltin.h" +#include "output.h" /* Wrapper for memory allocation calls that should have their results registered in the PPH streamer cache. DATA is the pointer returned @@ -1309,7 +1310,7 @@ pph_read_file_contents (pph_stream *stream) { bool verified; cpp_ident_use *bad_use; - const char *cur_def; + const char *cur_def, *pph_fgon, *pph_wgon; cpp_idents_used idents_used; tree fndecl; unsigned i; @@ -1325,6 +1326,16 @@ pph_read_file_contents (pph_stream *stream) /* Re-instantiate all the pre-processor symbols defined by STREAM. */ cpp_lt_replay (parse_in, &idents_used); + /* If first_global_object_name is not set yet, set it to the pph one. */ + pph_fgon = pph_in_string (stream); + if (!first_global_object_name) + first_global_object_name = pph_fgon; + + /* If weak_global_object_name is not set yet, set it to the pph one. */ + pph_wgon = pph_in_string (stream); + if (!weak_global_object_name) + weak_global_object_name = pph_wgon; + /* Read the bindings from STREAM and merge them with the current bindings. */ pph_in_scope_chain (stream); diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c index acc0352..0d29f0b 100644 --- a/gcc/cp/pph-streamer-out.c +++ b/gcc/cp/pph-streamer-out.c @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "version.h" #include "cppbuiltin.h" +#include "output.h" /* FIXME pph. This holds the FILE handle for the current PPH file that we are writing. It is necessary because the LTO callbacks do @@ -1197,9 +1198,14 @@ static void pph_write_file_contents (pph_stream *stream, cpp_idents_used *idents_used) { pph_out_identifiers (stream, idents_used); + + pph_out_string (stream, first_global_object_name); + pph_out_string (stream, weak_global_object_name); + pph_out_scope_chain (stream, scope_chain, false); if (flag_pph_dump_tree) pph_dump_namespace (pph_logfile, global_namespace); + pph_out_tree (stream, keyed_classes, false); pph_out_tree_vec (stream, unemitted_tinfo_decls, false); } -- This patch is available for review at http://codereview.appspot.com/4641086