From patchwork Thu Sep 13 16:45:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [google] Fix duplicate symbol error reported by assembler Date: Thu, 13 Sep 2012 06:45:12 -0000 From: Xinliang David Li X-Patchwork-Id: 183680 Message-Id: To: GCC Patches The following patch fixes a problem exposed in LIPO random stress testing with large module groups -- the error is that multiple copies compiler generated static functions (ctor of class in anonymous namespace) get emitted. David Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 191267) +++ cgraphunit.c (revision 191268) @@ -1430,7 +1430,12 @@ cgraph_add_output_node (struct cgraph_no if (!L_IPO_COMP_MODE) return node; - if (!TREE_PUBLIC (node->decl)) + /* Never common non public names except for compiler + generated static functions. (they are not promoted + to globals either. */ + if (!TREE_PUBLIC (node->decl) + && !(DECL_ARTIFICIAL (node->decl) + && DECL_ASSEMBLER_NAME_SET_P (node->decl))) return node; if (!output_node_hash)