On Sun, 9 Oct 2011, Jan Hubicka wrote:

> Hi,
> whopr currently produce local_static.1234.43124 type symbols. This is because
> everything gets mangled at WPA time and then again at ltrans time.  This 
> simply
> avoids the second mangling. This save some space & makes WHOPR/non_WHOPR 
> symbol
> tables comparable more directly.
> 
> Bootstrapped/regtested x86_64-linux, also tested with Mozilla LTO, OK?

Hmmm.  I'd really like to defer mangling to LTRANS at one point, as
we will know if there will be conflicts of local symbols at that point
(another point would be the partitioning code).  So this patch goes
backward ... (ideally a first step would move it to symbol resolution
time, another place where we can check for conflicts, and then only
apply it a LTRANs stage).

Richard.

> Honza
> 
>       * lto.c (lto_register_var_decl_in_symtab,
>       lto_register_function_decl_in_symtab): Do not mangle at ltrans time.
>       * lto-lang.c (lto_set_decl_assembler_name): Likewise.
> Index: lto/lto.c
> ===================================================================
> --- lto/lto.c (revision 179664)
> +++ lto/lto.c (working copy)
> @@ -604,7 +604,7 @@ lto_register_var_decl_in_symtab (struct
>  
>    /* Variable has file scope, not local. Need to ensure static variables
>       between different files don't clash unexpectedly.  */
> -  if (!TREE_PUBLIC (decl)
> +  if (!TREE_PUBLIC (decl) && !flag_ltrans
>        && !((context = decl_function_context (decl))
>          && auto_var_in_fn_p (decl, context)))
>      {
> @@ -646,7 +646,7 @@ lto_register_function_decl_in_symtab (st
>  {
>    /* Need to ensure static entities between different files
>       don't clash unexpectedly.  */
> -  if (!TREE_PUBLIC (decl))
> +  if (!TREE_PUBLIC (decl) && !flag_ltrans)
>      {
>        /* We must not use the DECL_ASSEMBLER_NAME macro here, as it
>        may set the assembler name where it was previously empty.  */
> Index: lto/lto-lang.c
> ===================================================================
> --- lto/lto-lang.c    (revision 179664)
> +++ lto/lto-lang.c    (working copy)
> @@ -954,7 +954,7 @@ lto_set_decl_assembler_name (tree decl)
>       TREE_PUBLIC, to avoid conflicts between individual files.  */
>    tree id;
>  
> -  if (TREE_PUBLIC (decl))
> +  if (TREE_PUBLIC (decl) || flag_ltrans)
>      id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl));
>    else
>      {
> 
> 

-- 
Richard Guenther <rguent...@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Reply via email to