diff mbox

[Google] fix a bug in lipo varpool node linking

Message ID CAF1bQ=RgU3+iSqT1TTuWqJ-5U+tR1Qr9DLCedDMnbM_kCuApAQ@mail.gmail.com
State New
Headers show

Commit Message

Rong Xu Aug. 16, 2013, 8:28 p.m. UTC
This patch fixed a bug in lipo varpool node linking.

C++ FE drops the initializer if it's not used in this TU. For current
varpool linking may
resolve the varpool node to the one with null initializer.

-Rong

Comments

Xinliang David Li Aug. 16, 2013, 9:37 p.m. UTC | #1
ok.

David

On Fri, Aug 16, 2013 at 1:28 PM, Rong Xu <xur@google.com> wrote:
> This patch fixed a bug in lipo varpool node linking.
>
> C++ FE drops the initializer if it's not used in this TU. For current
> varpool linking may
> resolve the varpool node to the one with null initializer.
>
> -Rong
>
>
> Index: l-ipo.c
> ===================================================================
> --- l-ipo.c     (revision 201800)
> +++ l-ipo.c     (working copy)
> @@ -2151,6 +2151,19 @@ resolve_varpool_node (struct varpool_node **slot,
>        return;
>      }
>
> +  if (DECL_INITIAL (decl1) && !DECL_INITIAL (decl2))
> +    {
> +      merge_addressable_attr (decl1, decl2);
> +      return;
> +    }
> +
> +  if (!DECL_INITIAL (decl1) && DECL_INITIAL (decl2))
> +    {
> +      *slot = node;
> +      merge_addressable_attr (decl2, decl1);
> +      return;
> +    }
> +
>    /* Either all complete or neither's type is complete. Just
>       pick the primary module's decl.  */
>    if (!varpool_is_auxiliary (*slot))
diff mbox

Patch

Index: l-ipo.c
===================================================================
--- l-ipo.c     (revision 201800)
+++ l-ipo.c     (working copy)
@@ -2151,6 +2151,19 @@  resolve_varpool_node (struct varpool_node **slot,
       return;
     }

+  if (DECL_INITIAL (decl1) && !DECL_INITIAL (decl2))
+    {
+      merge_addressable_attr (decl1, decl2);
+      return;
+    }
+
+  if (!DECL_INITIAL (decl1) && DECL_INITIAL (decl2))
+    {
+      *slot = node;
+      merge_addressable_attr (decl2, decl1);
+      return;
+    }
+
   /* Either all complete or neither's type is complete. Just
      pick the primary module's decl.  */
   if (!varpool_is_auxiliary (*slot))