Fixes a problem caused by my recent change to allow aux functions to be removed. They need to be kept until after LIPO linking/static promotion, since they affect the promoted names of any static variables defined within their context.
Passes regression and internal testing. Ok for google/4_9? Thanks, Teresa 2015-01-02 Teresa Johnson <tejohn...@google.com> Google ref b/18882262. * cgraph.c (cgraph_can_remove_if_no_direct_calls_and_refs_p): Keep aux functions until after LIPO linking. Index: cgraph.c =================================================================== --- cgraph.c (revision 219100) +++ cgraph.c (working copy) @@ -2462,8 +2462,13 @@ cgraph_can_remove_if_no_direct_calls_and_refs_p (s { gcc_assert (!node->global.inlined_to); /* Extern inlines can always go, we will use the external definition. */ - if (DECL_EXTERNAL (node->decl) || cgraph_is_aux_decl_external (node)) + if (DECL_EXTERNAL (node->decl)) return true; + /* Aux functions are safe to remove, but only once static promotion is + complete since they may affect promoted names if they are the context + for any static variables. */ + if (cgraph_pre_profiling_inlining_done && cgraph_is_aux_decl_external (node)) + return true; /* When function is needed, we can not remove it. */ if (node->force_output || node->used_from_other_partition) return false; -- Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413