Patchwork [google,4.7] fix unsatified symbols in lipo-use (issue6562044)

login
register
mail settings
Submitter Rong Xu
Date Sept. 24, 2012, 9:40 p.m.
Message ID <20120924214034.4F23B55CAA@rong2.dls.corp.google.com>
Download mbox | patch
Permalink /patch/186578/
State New
Headers show

Comments

Rong Xu - Sept. 24, 2012, 9:40 p.m.
Hi, 

This patch is for google branches only.
It fixes the unsatified symbol in lipo-use build.
Tested with SPEC and google internal benchmarks.

Thanks,

-Rong


2012-09-24  Rong Xu  <xur@google.com>
        
	* gcc/l-ipo.c (cgraph_is_aux_decl_external): output comdat
virtual functions when they are auxiliary modules; otherwise we may
get undefined symbol in linking.
        Google ref b/7078882.



--
This patch is available for review at http://codereview.appspot.com/6562044
Xinliang David Li - Sept. 24, 2012, 9:47 p.m.
ok.

David

On Mon, Sep 24, 2012 at 2:40 PM, Rong Xu <xur@google.com> wrote:
> Hi,
>
> This patch is for google branches only.
> It fixes the unsatified symbol in lipo-use build.
> Tested with SPEC and google internal benchmarks.
>
> Thanks,
>
> -Rong
>
>
> 2012-09-24  Rong Xu  <xur@google.com>
>
>         * gcc/l-ipo.c (cgraph_is_aux_decl_external): output comdat
> virtual functions when they are auxiliary modules; otherwise we may
> get undefined symbol in linking.
>         Google ref b/7078882.
>
>
> Index: gcc/l-ipo.c
> ===================================================================
> --- gcc/l-ipo.c (revision 191679)
> +++ gcc/l-ipo.c (working copy)
> @@ -1111,16 +1111,16 @@
>    if (node->is_versioned_clone)
>      return false;
>
> -  /* virtual functions won't be deleted in the primary module.  */
> -  if (DECL_VIRTUAL_P (decl))
> -    return true;
> -
>    /* Comdat or weak functions in aux modules are not external --
>       there is no guarantee that the definitition will be emitted
>       in the primary compilation of this auxiliary module.  */
>    if (DECL_COMDAT (decl) || DECL_WEAK (decl))
>      return false;
>
> +  /* virtual functions won't be deleted in the primary module.  */
> +  if (DECL_VIRTUAL_P (decl))
> +    return true;
> +
>    if (!TREE_PUBLIC (decl))
>      return false;
>
>
> --
> This patch is available for review at http://codereview.appspot.com/6562044

Patch

Index: gcc/l-ipo.c
===================================================================
--- gcc/l-ipo.c	(revision 191679)
+++ gcc/l-ipo.c	(working copy)
@@ -1111,16 +1111,16 @@ 
   if (node->is_versioned_clone)
     return false;
 
-  /* virtual functions won't be deleted in the primary module.  */
-  if (DECL_VIRTUAL_P (decl))
-    return true;
-
   /* Comdat or weak functions in aux modules are not external --
      there is no guarantee that the definitition will be emitted
      in the primary compilation of this auxiliary module.  */
   if (DECL_COMDAT (decl) || DECL_WEAK (decl))
     return false;
 
+  /* virtual functions won't be deleted in the primary module.  */
+  if (DECL_VIRTUAL_P (decl))
+    return true;
+
   if (!TREE_PUBLIC (decl))
     return false;