[lto][patch] Fix missing vtables. Some global variables were not being finalized.

Bill Maddox maddox@google.com
Fri Sep 5 01:57:00 GMT 2008


This patch fixes certain cases in which a C++ program fails to link
with -flto-single
because the code includes a reference to a vtable that was not
emitted.  This was
due to failure to invoke rest_of_decl_compilation on the
compiler-generated vtable
VAR_DECLs.   For most globals, this occurs in lto_main, which expects
to find the
VAR_DECLs in array lto_global_var_decls.  VAR_DECLs are added to this array
in lto_symtab_merge_decl, which was not being called.

gcc:

	* lto-function-in.c (input_var_decl): Use decl_function_context
	rather than DECL_FILE_SCOPE_P to determine whether a VAR_DECL
	is global.

gcc/lto:

	* lto-symtab.c (lto_symtab_merge_decl): Add comment.

gcc/testsuite/g++.dg/other:

	* g++.dg/other/lto3.C:  New test.

--Bill
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: streamer-vtable-patch-08-04.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080905/3dddfe86/attachment.txt>


More information about the Gcc-patches mailing list