aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto/lto-symtab.h
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-12-09 03:15:05 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-12-09 02:15:05 +0000
commit6b9ac1796ec8eed79e8d5e4ef03a347a6c86a25c (patch)
tree77618157acd1764e5dd8967035809f5e54b46242 /gcc/lto/lto-symtab.h
parent1a161cd7a7545318c1ee29dfd2eb76ee6ee9f43e (diff)
downloadgcc-6b9ac1796ec8eed79e8d5e4ef03a347a6c86a25c.zip
gcc-6b9ac1796ec8eed79e8d5e4ef03a347a6c86a25c.tar.gz
gcc-6b9ac1796ec8eed79e8d5e4ef03a347a6c86a25c.tar.bz2
re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
PR ipa/61886 * lto-streamer.h (lto_symtab_merge_decls, lto_symtab_merge_symbols, lto_symtab_prevailing_decl): MOve to lto-symtab.h. * lto-streamer-out.c (DFS::DFS_write_tree_body): Check that DECL_ABSTRACT_ORIGIN is not error_mark_node. * lto-symtab.c: Include lto-symtab.h. (lto_cgraph_replace_node): Do not merge profiles here. (lto_symtab_merge_p): New function. (lto_symtab_merge_decls_2): Honor lto_symtab_merge_p. (lto_symtab_merge_symbols_1): Turn unmerged decls into transparent aliases. (lto_symtab_merge_symbols): Do not clear node->aux; we no longer use it. (lto_symtab_prevailing_decl): Move to lto-symtab.h; rewrite. * lto.c: Include lto-symtab.h * lto-symtab.h: New. From-SVN: r231438
Diffstat (limited to 'gcc/lto/lto-symtab.h')
-rw-r--r--gcc/lto/lto-symtab.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/lto/lto-symtab.h b/gcc/lto/lto-symtab.h
new file mode 100644
index 0000000..c6b68b6
--- /dev/null
+++ b/gcc/lto/lto-symtab.h
@@ -0,0 +1,47 @@
+/* LTO symbol table merging.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+extern void lto_symtab_merge_decls (void);
+extern void lto_symtab_merge_symbols (void);
+extern tree lto_symtab_prevailing_decl (tree decl);
+
+/* Mark DECL to be previailed by PREVAILING.
+ Use DECL_ABSTRACT_ORIGIN and DECL_CHAIN as special markers; those do not
+ disturb debug_tree and diagnostics.
+ We are safe to modify them as we wish, becuase the declarations disappear
+ from the IL after the merging. */
+
+inline void
+lto_symtab_prevail_decl (tree prevailing, tree decl)
+{
+ gcc_checking_assert (DECL_ABSTRACT_ORIGIN (decl) != error_mark_node);
+ DECL_CHAIN (decl) = prevailing;
+ DECL_ABSTRACT_ORIGIN (decl) = error_mark_node;
+}
+
+/* Given the decl DECL, return the prevailing decl with the same name. */
+
+inline tree
+lto_symtab_prevailing_decl (tree decl)
+{
+ if (DECL_ABSTRACT_ORIGIN (decl) == error_mark_node)
+ return DECL_CHAIN (decl);
+ else
+ return decl;
+}