aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorRichard Sandiford <r.sandiford@uk.ibm.com>2010-07-10 08:35:58 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2010-07-10 08:35:58 +0000
commit7e9b96974abe5a74beaab2f90d3b47bb52f97db1 (patch)
tree47fefa28d0e5dd7ef562214409a73540f77eb359 /gcc/tree.h
parent058bfe530068df2d3ccc4131a1837b44a83acba4 (diff)
downloadgcc-7e9b96974abe5a74beaab2f90d3b47bb52f97db1.zip
gcc-7e9b96974abe5a74beaab2f90d3b47bb52f97db1.tar.gz
gcc-7e9b96974abe5a74beaab2f90d3b47bb52f97db1.tar.bz2
tree.h (DECL_REPLACEABLE_P): Strengthen check for weak symbols.
gcc/ * tree.h (DECL_REPLACEABLE_P): Strengthen check for weak symbols. gcc/testsuite/ * gcc.dg/attr-weak-hidden-1.c, gcc.dg/attr-weak-hidden-1a.c: New test. From-SVN: r162031
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 59f6b3a..e749d69 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3012,6 +3012,11 @@ struct GTY(()) tree_parm_decl {
not be treated as replaceable so that use of C++ template
instantiations is not penalized.
+ In other respects, the condition is usually equivalent to whether
+ the function binds to the current module (shared library or executable).
+ However, weak functions can always be overridden by earlier TUs
+ in the same module, even if they bind locally to that module.
+
For example, DECL_REPLACEABLE is used to determine whether or not a
function (including a template instantiation) which is not
explicitly declared "inline" can be inlined. If the function is
@@ -3020,7 +3025,7 @@ struct GTY(()) tree_parm_decl {
function that is not DECL_REPLACEABLE can be inlined, since all
versions of the function will be functionally identical. */
#define DECL_REPLACEABLE_P(NODE) \
- (!DECL_COMDAT (NODE) && !targetm.binds_local_p (NODE))
+ (!DECL_COMDAT (NODE) && (DECL_WEAK (NODE) || !targetm.binds_local_p (NODE)))
/* The name of the object as the assembler will see it (but before any
translations made by ASM_OUTPUT_LABELREF). Often this is the same