diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-04 12:19:25 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-04 12:19:25 +0000 |
commit | 871609a88879001db690e86f792cdc83a495074d (patch) | |
tree | 621502d44633d587a4706564dbe2902f5db4f1e5 /gcc/lto-symtab.c | |
parent | 9810271115ba7fa241574b24ff63e94d6d294aa3 (diff) | |
download | gcc-871609a88879001db690e86f792cdc83a495074d.tar.gz |
2013-02-04 Richard Guenther <rguenther@suse.de>
PR lto/56168
* lto-symtab.c (lto_symtab_merge_decls_1): Make non-builtin
node prevail as last resort.
(lto_symtab_merge_decls): Remove guard on LTRANS here.
(lto_symtab_prevailing_decl): Builtins are their own prevailing
decl.
lto/
* lto.c (read_cgraph_and_symbols): Do not call lto_symtab_merge_decls
or lto_fixup_decls at LTRANS time.
* gcc.dg/lto/pr56168_0.c: New testcase.
* gcc.dg/lto/pr56168_1.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195709 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-symtab.c')
-rw-r--r-- | gcc/lto-symtab.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 546601d5eba..2b182ffaedf 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -439,12 +439,12 @@ lto_symtab_merge_decls_1 (symtab_node first) && COMPLETE_TYPE_P (TREE_TYPE (e->symbol.decl))) prevailing = e; } - /* For variables prefer the builtin if one is available. */ + /* For variables prefer the non-builtin if one is available. */ else if (TREE_CODE (prevailing->symbol.decl) == FUNCTION_DECL) { for (e = first; e; e = e->symbol.next_sharing_asm_name) if (TREE_CODE (e->symbol.decl) == FUNCTION_DECL - && DECL_BUILT_IN (e->symbol.decl)) + && !DECL_BUILT_IN (e->symbol.decl)) { prevailing = e; break; @@ -507,12 +507,6 @@ lto_symtab_merge_decls (void) { symtab_node node; - /* In ltrans mode we read merged cgraph, we do not really need to care - about resolving symbols again, we only need to replace duplicated declarations - read from the callgraph and from function sections. */ - if (flag_ltrans) - return; - /* Populate assembler name hash. */ symtab_initialize_asm_name_hash (); @@ -598,6 +592,11 @@ lto_symtab_prevailing_decl (tree decl) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT (decl)) return decl; + /* Likewise builtins are their own prevailing decl. This preserves + non-builtin vs. builtin uses from compile-time. */ + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl)) + return decl; + /* Ensure DECL_ASSEMBLER_NAME will not set assembler name. */ gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl)); |