diff options
| author | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-27 15:43:19 +0000 |
|---|---|---|
| committer | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-27 15:43:19 +0000 |
| commit | b1be8e042dc5dbdbc46b8e8b5ff27225a683369a (patch) | |
| tree | 3f19475141947ad20e92258cbb87e0916a1a6fbf | |
| parent | c7e8d0da3aec56d4b763f07b1e0ab6da468bf392 (diff) | |
| download | ppe42-gcc-b1be8e042dc5dbdbc46b8e8b5ff27225a683369a.tar.gz ppe42-gcc-b1be8e042dc5dbdbc46b8e8b5ff27225a683369a.zip | |
PR middle-end/41674
* cgraphunit.c (cgraph_build_static_cdtor): If target doesn't have
cdtors, set DECL_PRESERVE_P.
* ipa.c (cgraph_externally_visible_p): Return true if declaration
should be preseved.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157779 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 8 | ||||
| -rw-r--r-- | gcc/cgraphunit.c | 6 | ||||
| -rw-r--r-- | gcc/ipa.c | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 393e7530b91..5c6d82cbad2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2010-03-27 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR middle-end/41674 + * cgraphunit.c (cgraph_build_static_cdtor): If target doesn't have + cdtors, set DECL_PRESERVE_P. + * ipa.c (cgraph_externally_visible_p): Return true if declaration + should be preseved. + 2010-03-27 Uros Bizjak <ubizjak@gmail.com> PR tree-optimization/43528 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index c41477bede3..185fc538d7d 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1946,7 +1946,11 @@ cgraph_build_static_cdtor (char which, tree body, int priority) DECL_ARTIFICIAL (decl) = 1; DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) = 1; DECL_SAVED_TREE (decl) = body; - TREE_PUBLIC (decl) = ! targetm.have_ctors_dtors; + if (!targetm.have_ctors_dtors) + { + TREE_PUBLIC (decl) = 1; + DECL_PRESERVE_P (decl) = 1; + } DECL_UNINLINABLE (decl) = 1; DECL_INITIAL (decl) = make_node (BLOCK); diff --git a/gcc/ipa.c b/gcc/ipa.c index c789a29372d..225f268219b 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -317,6 +317,8 @@ cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program) return false; if (!whole_program) return true; + if (DECL_PRESERVE_P (node->decl)) + return true; /* COMDAT functions must be shared only if they have address taken, otherwise we can produce our own private implementation with -fwhole-program. */ |

