diff mbox

[GOOGLE] Check if varpool node exist for decl before checking if it's from auxiliary module.

Message ID CAO2gOZWhhmJom0geJBVeVaRFbqqUE7xgNgUO5bwRXUsUK--LuA@mail.gmail.com
State New
Headers show

Commit Message

Dehao Chen Oct. 22, 2013, 5:51 p.m. UTC
This is fixing a LIPO bug when there -fexception is on.

When compilation is finished, compile_file calls
dw2_output_indirect_constants, which may generate decls like
DW.ref.__gxx_personality_v0 (generated in
dw2_output_indirect_constant_1). This function is a global function,
but does not have associated varpool node. So original code will
segfault when checking if the varpool node is from auxiliary module.

Verified that the segfault is fixed with the patch. Regression test on-going.

OK for google-4_8 branch if reg test is green?

Thanks,
Dehao

Comments

Rong Xu Oct. 22, 2013, 5:55 p.m. UTC | #1
seems fine to me for google branches.

-Rong

On Tue, Oct 22, 2013 at 10:51 AM, Dehao Chen <dehao@google.com> wrote:
> This is fixing a LIPO bug when there -fexception is on.
>
> When compilation is finished, compile_file calls
> dw2_output_indirect_constants, which may generate decls like
> DW.ref.__gxx_personality_v0 (generated in
> dw2_output_indirect_constant_1). This function is a global function,
> but does not have associated varpool node. So original code will
> segfault when checking if the varpool node is from auxiliary module.
>
> Verified that the segfault is fixed with the patch. Regression test on-going.
>
> OK for google-4_8 branch if reg test is green?
>
> Thanks,
> Dehao
>
> Index: gcc/varasm.c
> ===================================================================
> --- gcc/varasm.c (revision 203910)
> +++ gcc/varasm.c (working copy)
> @@ -1484,7 +1484,7 @@ notice_global_symbol (tree decl)
>    if (L_IPO_COMP_MODE
>        && ((TREE_CODE (decl) == FUNCTION_DECL
>             && cgraph_is_auxiliary (decl))
> -          || (TREE_CODE (decl) == VAR_DECL
> +          || (TREE_CODE (decl) == VAR_DECL && varpool_get_node (decl)
>                && varpool_is_auxiliary (varpool_get_node (decl)))))
>      return;
Xinliang David Li Oct. 22, 2013, 6:36 p.m. UTC | #2
ok.

David

On Tue, Oct 22, 2013 at 10:51 AM, Dehao Chen <dehao@google.com> wrote:
> This is fixing a LIPO bug when there -fexception is on.
>
> When compilation is finished, compile_file calls
> dw2_output_indirect_constants, which may generate decls like
> DW.ref.__gxx_personality_v0 (generated in
> dw2_output_indirect_constant_1). This function is a global function,
> but does not have associated varpool node. So original code will
> segfault when checking if the varpool node is from auxiliary module.
>
> Verified that the segfault is fixed with the patch. Regression test on-going.
>
> OK for google-4_8 branch if reg test is green?
>
> Thanks,
> Dehao
>
> Index: gcc/varasm.c
> ===================================================================
> --- gcc/varasm.c (revision 203910)
> +++ gcc/varasm.c (working copy)
> @@ -1484,7 +1484,7 @@ notice_global_symbol (tree decl)
>    if (L_IPO_COMP_MODE
>        && ((TREE_CODE (decl) == FUNCTION_DECL
>             && cgraph_is_auxiliary (decl))
> -          || (TREE_CODE (decl) == VAR_DECL
> +          || (TREE_CODE (decl) == VAR_DECL && varpool_get_node (decl)
>                && varpool_is_auxiliary (varpool_get_node (decl)))))
>      return;
diff mbox

Patch

Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c (revision 203910)
+++ gcc/varasm.c (working copy)
@@ -1484,7 +1484,7 @@  notice_global_symbol (tree decl)
   if (L_IPO_COMP_MODE
       && ((TREE_CODE (decl) == FUNCTION_DECL
            && cgraph_is_auxiliary (decl))
-          || (TREE_CODE (decl) == VAR_DECL
+          || (TREE_CODE (decl) == VAR_DECL && varpool_get_node (decl)
               && varpool_is_auxiliary (varpool_get_node (decl)))))
     return;