/* Callgraph handling code.
- Copyright (C) 2003-2018 Free Software Foundation, Inc.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
Contributed by Jan Hubicka
This file is part of GCC.
varpool_node *
varpool_node::create_empty (void)
-{
- varpool_node *node = ggc_cleared_alloc<varpool_node> ();
- node->type = SYMTAB_VARIABLE;
- return node;
+{
+ return new (ggc_alloc<varpool_node> ()) varpool_node ();
}
/* Return varpool node assigned to DECL. Create new one when needed. */
&& debug_info_level == DINFO_LEVEL_NONE
/* When doing declaration merging we have duplicate
entries for given decl. Do not attempt to remove
- the boides, or we will end up remiving
+ the bodies, or we will end up removing
wrong one. */
&& symtab->state != LTO_STREAMING)
DECL_INITIAL (decl) = error_mark_node;
fprintf (f, " output");
if (used_by_single_function)
fprintf (f, " used-by-single-function");
- if (need_bounds_init)
- fprintf (f, " need-bounds-init");
if (TREE_READONLY (decl))
fprintf (f, " read-only");
if (ctor_useable_for_folding_p ())
= lto_get_function_in_decl_state (file_data, decl);
data = lto_get_section_data (file_data, LTO_section_function_body,
- name, &len, decl_state->compressed);
+ name, order - file_data->order_base,
+ &len, decl_state->compressed);
if (!data)
- fatal_error (input_location, "%s: section %s is missing",
+ fatal_error (input_location, "%s: section %s.%d is missing",
file_data->file_name,
- name);
+ name, order - file_data->order_base);
+ if (!quiet_flag)
+ fprintf (stderr, " in:%s", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
lto_input_variable_constructor (file_data, this, data);
gcc_assert (DECL_INITIAL (decl) != error_mark_node);
lto_stats.num_function_bodies++;
if (TREE_THIS_VOLATILE (decl))
return false;
+ /* Avoid attempts to load constructors that was not streamed. */
+ if (in_lto_p && DECL_INITIAL (real_node->decl) == error_mark_node
+ && real_node->body_removed)
+ return false;
+
/* If we do not have a constructor, we can't use it. */
if (DECL_INITIAL (real_node->decl) == error_mark_node
&& !real_node->lto_file_data)
return false;
- /* Avoid attempts to load constructors that was not streamed. */
- if (flag_ltrans && DECL_INITIAL (real_node->decl) == error_mark_node
- && real_node->body_removed)
- return false;
-
/* Vtables are defined by their types and must match no matter of interposition
rules. */
if (DECL_VIRTUAL_P (decl))
return DECL_INITIAL (real_node->decl) != NULL;
}
- /* Alias of readonly variable is also readonly, since the variable is stored
- in readonly memory. We also accept readonly aliases of non-readonly
- locations assuming that user knows what he is asking for. */
+ /* An alias of a read-only variable is also read-only, since the variable
+ is stored in read-only memory. We also accept read-only aliases of
+ non-read-only locations assuming that the user knows what he is asking
+ for. */
if (!TREE_READONLY (decl) && !TREE_READONLY (real_node->decl))
return false;
overridden at link or run time.
It is actually requirement for C++ compiler to optimize const variables
- consistently. As a GNU extension, do not enfore this rule for user defined
+ consistently. As a GNU extension, do not enforce this rule for user defined
weak variables, so we support interposition on:
static const int dummy = 0;
extern const int foo __attribute__((__weak__, __alias__("dummy")));
if (!VAR_P (decl) && TREE_CODE (decl) != CONST_DECL)
return error_mark_node;
- /* Static constant bounds are created to be
- used instead of constants and therefore
- do not let folding it. */
- if (POINTER_BOUNDS_P (decl))
- return error_mark_node;
-
if (TREE_CODE (decl) == CONST_DECL
|| DECL_IN_CONSTANT_POOL (decl))
return DECL_INITIAL (decl);
return error_mark_node;
/* Do not care about automatic variables. Those are never initialized
- anyway, because gimplifier exapnds the code. */
+ anyway, because gimplifier expands the code. */
if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
{
gcc_assert (!TREE_PUBLIC (decl));
FOR_EACH_ALIAS (this, ref)
{
varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
- if (!alias->transparent_alias)
+ if (alias->symver)
+ do_assemble_symver (alias->decl,
+ DECL_ASSEMBLER_NAME (decl));
+ else if (!alias->transparent_alias)
do_assemble_alias (alias->decl,
DECL_ASSEMBLER_NAME (decl));
alias->assemble_aliases ();
bool
varpool_node::assemble_decl (void)
{
- /* Aliases are outout when their target is produced or by
+ /* Aliases are output when their target is produced or by
output_weakrefs. */
if (alias)
return false;
{
enqueue_node (node, &first);
if (dump_file)
- fprintf (dump_file, " %s", node->asm_name ());
+ fprintf (dump_file, " %s", node->dump_asm_name ());
}
}
while (first != (varpool_node *)(void *)1)
if (!node->aux && !node->no_reorder)
{
if (dump_file)
- fprintf (dump_file, " %s", node->asm_name ());
+ fprintf (dump_file, " %s", node->dump_asm_name ());
if (referenced.contains(node))
node->remove_initializer ();
else
alias_node = varpool_node::create_alias (alias, decl);
alias_node->cpp_implicit_alias = true;
- /* Extra name alias mechanizm creates aliases really late
- via DECL_ASSEMBLER_NAME mechanizm.
+ /* Extra name alias mechanism creates aliases really late
+ via DECL_ASSEMBLER_NAME mechanism.
This is unfortunate because they are not going through the
standard channels. Ensure they get output. */
if (symtab->cpp_implicit_aliases_done)