diff gcc/varpool.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line diff
--- a/gcc/varpool.c	Thu Oct 25 07:37:49 2018 +0900
+++ b/gcc/varpool.c	Thu Feb 13 11:34:05 2020 +0900
@@ -1,5 +1,5 @@
 /* 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.
@@ -133,10 +133,8 @@
 
 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.  */
@@ -204,7 +202,7 @@
       && 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;
@@ -226,8 +224,6 @@
     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 ())
@@ -301,11 +297,12 @@
 	 = 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)));
@@ -335,16 +332,16 @@
   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))
@@ -355,9 +352,10 @@
       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;
 
@@ -366,7 +364,7 @@
      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"))); 
@@ -410,7 +408,7 @@
     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));
@@ -541,7 +539,10 @@
   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 ();
@@ -553,7 +554,7 @@
 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;
@@ -639,7 +640,7 @@
 	{
 	  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)
@@ -687,7 +688,7 @@
       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
@@ -791,8 +792,8 @@
   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)