This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto][patch] Remove RESULT_DECL from the symbol table
- From: "Rafael Espindola" <espindola at google dot com>
- To: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Cc: "Diego Novillo" <dnovillo at google dot com>
- Date: Tue, 23 Sep 2008 16:28:48 +0100
- Subject: [lto][patch] Remove RESULT_DECL from the symbol table
The linker need not know about the RESULT_DECLs. Only things that
would be in a normal symbol table need to be in the IL symbol table.
2008-09-23 Rafael Espindola <espindola@google.com>
* lto-section-out.c (write_symbol_vec): Don't write RESULT_DECL to the
symbol table.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index c5d2185..f500527 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -1113,13 +1113,13 @@ write_symbol_vec (htab_t hash, struct lto_output_stream *stream,
if (!TREE_PUBLIC (t))
continue;
- if (TREE_CODE (t) == VAR_DECL
- || TREE_CODE (t) == FUNCTION_DECL)
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (t));
- else if (TREE_CODE (t) == RESULT_DECL)
- name = "<retval>";
- else
- gcc_unreachable ();
+ if (TREE_CODE (t) == RESULT_DECL)
+ continue;
+
+ gcc_assert (TREE_CODE (t) == VAR_DECL
+ || TREE_CODE (t) == FUNCTION_DECL);
+
+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (t));
d_slot.t = t;
slot = htab_find_slot (hash, &d_slot, NO_INSERT);
@@ -1132,60 +1132,50 @@ write_symbol_vec (htab_t hash, struct lto_output_stream *stream,
else
bitmap_set_bit (seen, slot_num);
- if (TREE_CODE (t) != RESULT_DECL)
+ if (DECL_EXTERNAL (t))
{
- if (DECL_EXTERNAL (t))
- {
- if (DECL_WEAK (t))
- kind = GCCPK_WEAKUNDEF;
- else
- kind = GCCPK_UNDEF;
- }
+ if (DECL_WEAK (t))
+ kind = GCCPK_WEAKUNDEF;
else
- {
- if (DECL_WEAK (t))
- kind = GCCPK_WEAKDEF;
- else if (DECL_COMMON (t))
- kind = GCCPK_COMMON;
- else
- kind = GCCPK_DEF;
- }
-
- switch (DECL_VISIBILITY(t))
- {
- case VISIBILITY_DEFAULT:
- visibility = GCCPV_DEFAULT;
- break;
- case VISIBILITY_PROTECTED:
- visibility = GCCPV_PROTECTED;
- break;
- case VISIBILITY_HIDDEN:
- visibility = GCCPV_HIDDEN;
- break;
- case VISIBILITY_INTERNAL:
- visibility = GCCPV_INTERNAL;
- break;
- }
-
- if (kind == GCCPK_COMMON)
- size = (((uint64_t) TREE_INT_CST_HIGH (DECL_SIZE (t))) << 32)
- | TREE_INT_CST_LOW (DECL_SIZE (t));
- else
- size = 0;
-
- if (DECL_COMDAT (t))
- comdat = lang_hooks.decls.comdat_group (t);
- else
- comdat = "";
+ kind = GCCPK_UNDEF;
}
else
{
- kind = GCCPK_DEF;
+ if (DECL_WEAK (t))
+ kind = GCCPK_WEAKDEF;
+ else if (DECL_COMMON (t))
+ kind = GCCPK_COMMON;
+ else
+ kind = GCCPK_DEF;
+ }
+
+ switch (DECL_VISIBILITY(t))
+ {
+ case VISIBILITY_DEFAULT:
+ visibility = GCCPV_DEFAULT;
+ break;
+ case VISIBILITY_PROTECTED:
+ visibility = GCCPV_PROTECTED;
+ break;
+ case VISIBILITY_HIDDEN:
+ visibility = GCCPV_HIDDEN;
+ break;
+ case VISIBILITY_INTERNAL:
visibility = GCCPV_INTERNAL;
- size = 0;
- comdat = "";
+ break;
}
+ if (kind == GCCPK_COMMON)
+ size = (((uint64_t) TREE_INT_CST_HIGH (DECL_SIZE (t))) << 32)
+ | TREE_INT_CST_LOW (DECL_SIZE (t));
+ else
+ size = 0;
+
+ if (DECL_COMDAT (t))
+ comdat = lang_hooks.decls.comdat_group (t);
+ else
+ comdat = "";
+
lto_output_data_stream (stream, name, strlen (name) + 1);
lto_output_data_stream (stream, comdat, strlen (comdat) + 1);
lto_output_data_stream (stream, &kind, 1);