From 5d96330ac864e99e367c7ffcb88a685342a1e38c Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 11 Dec 2009 10:56:17 +0000 Subject: re PR middle-end/42320 (link error with -flto (undefined reference to 'non-virtual thunk ...)) 2009-12-11 Richard Guenther PR lto/42320 * lto-symtab.c (lto_symtab_resolve_can_prevail_p): Properly detect non-prevailing decls. * g++.dg/lto/20091210-1_0.h: New testcase. * g++.dg/lto/20091210-1_0.C: Likewise. * g++.dg/lto/20091210-1_1.C: Likewise. From-SVN: r155155 --- gcc/lto-symtab.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/lto-symtab.c') diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index ab96b48..79eb3e4 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -371,7 +371,10 @@ lto_symtab_resolve_replaceable_p (lto_symtab_entry_t e) static bool lto_symtab_resolve_can_prevail_p (lto_symtab_entry_t e) { - if (!TREE_STATIC (e->decl)) + /* The C++ frontend ends up neither setting TREE_STATIC nor + DECL_EXTERNAL on virtual methods but only TREE_PUBLIC. + So do not reject !TREE_STATIC here but only DECL_EXTERNAL. */ + if (DECL_EXTERNAL (e->decl)) return false; /* For functions we need a non-discarded body. */ -- cgit v1.1