OSDN Git Service

* java/util/zip/ZipEntry.java (setCompressedSize): Allow any
[pf3gnuchains/gcc-fork.git] / gcc / varasm.c
index 79503d1..7c58b98 100644 (file)
@@ -3021,6 +3021,7 @@ force_const_mem (enum machine_mode mode, rtx x)
   /* Construct the MEM.  */
   desc->mem = def = gen_const_mem (mode, symbol);
   set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);
+  set_mem_align (def, align);
 
   /* If we're dropping a label to the constant pool, make sure we
      don't delete it.  */
@@ -4343,7 +4344,7 @@ globalize_decl (tree decl)
    the symbol for TARGET.  */
 
 void
-assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED)
+assemble_alias (tree decl, tree target)
 {
   const char *name;
 
@@ -4394,6 +4395,44 @@ assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED)
 #endif
 #endif
 
+  /* Tell cgraph that the aliased symbol is needed.  We *could* be more
+     specific and tell cgraph about the relationship between the two
+     symbols, but given that aliases virtually always exist for a reason,
+     it doesn't seem worthwhile.  */
+  if (flag_unit_at_a_time)
+    {
+      struct cgraph_node *fnode = NULL;
+      struct cgraph_varpool_node *vnode = NULL;
+
+      if (TREE_CODE (decl) == FUNCTION_DECL)
+       {
+         fnode = cgraph_node_for_asm (target);
+         if (fnode != NULL)
+           cgraph_mark_needed_node (fnode);
+         else
+           {
+             vnode = cgraph_varpool_node_for_asm (target);
+             if (vnode != NULL)
+               cgraph_varpool_mark_needed_node (vnode);
+           }
+       }
+      else
+       {
+         vnode = cgraph_varpool_node_for_asm (target);
+         if (vnode != NULL)
+           cgraph_varpool_mark_needed_node (vnode);
+         else
+           {
+             fnode = cgraph_node_for_asm (target);
+             if (fnode != NULL)
+               cgraph_mark_needed_node (fnode);
+           }
+       }
+
+      if (fnode == NULL && vnode == NULL)
+       warning ("%qD aliased to undefined symbol %qE", decl, target);
+    }
+
   TREE_USED (decl) = 1;
   TREE_ASM_WRITTEN (decl) = 1;
   TREE_ASM_WRITTEN (DECL_ASSEMBLER_NAME (decl)) = 1;