aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2015-02-13 04:52:45 +0000
committerRichard Henderson <rth@gcc.gnu.org>2015-02-12 20:52:45 -0800
commit6a1e352e1efbdf33a3df892dadd725f0b09c70c9 (patch)
tree0b7c95151ce5d3baedf0ed3fc3544b11a92ae3a7 /gcc/cgraphunit.c
parentfa47895fe650bc724adbdb3d5fd24348fd315277 (diff)
downloadgcc-6a1e352e1efbdf33a3df892dadd725f0b09c70c9.zip
gcc-6a1e352e1efbdf33a3df892dadd725f0b09c70c9.tar.gz
gcc-6a1e352e1efbdf33a3df892dadd725f0b09c70c9.tar.bz2
re PR rtl-optimization/32219 (optimizer causes wrong code in pic/hidden/weak symbol checking.)
PR rtl/32219 gcc/ * cgraphunit.c (cgraph_node::finalize_function): Set definition before notice_global_symbol. (varpool_node::finalize_decl): Likewise. * varasm.c (default_binds_local_p_2): Rename from default_binds_local_p_1, add weak_dominate argument. Use direct returns instead of assigning to local variable. Unify varpool and cgraph paths via symtab_node. Reject undef weak variables before testing visibility. Reorder tests for simplicity. (default_binds_local_p): Use default_binds_local_p_2. (default_binds_local_p_1): Likewise. (decl_binds_to_current_def_p): Unify varpool and cgraph paths via symtab_node. (default_elf_asm_output_external): Emit visibility when specified. gcc/testsuite/ * gcc.dg/visibility-22.c: New test. * gcc.dg/visibility-23.c: New test. * gcc.target/i386/pr32219-1.c: New test. * gcc.target/i386/pr32219-2.c: New test. * gcc.target/i386/pr32219-3.c: New test. * gcc.target/i386/pr32219-4.c: New test. * gcc.target/i386/pr32219-5.c: New test. * gcc.target/i386/pr32219-6.c: New test. * gcc.target/i386/pr32219-7.c: New test. * gcc.target/i386/pr32219-8.c: New test. * gcc.target/i386/pr64317.c: Expect GOTOFF, not GOT. Co-Authored-By: Richard Henderson <rth@redhat.com> From-SVN: r220674
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index f2c40d4..942826d 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -442,8 +442,10 @@ cgraph_node::finalize_function (tree decl, bool no_collect)
node->local.redefined_extern_inline = true;
}
- notice_global_symbol (decl);
+ /* Set definition first before calling notice_global_symbol so that
+ it is available to notice_global_symbol. */
node->definition = true;
+ notice_global_symbol (decl);
node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL;
/* With -fkeep-inline-functions we are keeping all inline functions except
@@ -803,8 +805,10 @@ varpool_node::finalize_decl (tree decl)
if (node->definition)
return;
- notice_global_symbol (decl);
+ /* Set definition first before calling notice_global_symbol so that
+ it is available to notice_global_symbol. */
node->definition = true;
+ notice_global_symbol (decl);
if (TREE_THIS_VOLATILE (decl) || DECL_PRESERVE_P (decl)
/* Traditionally we do not eliminate static variables when not
optimizing and when not doing toplevel reoder. */