* [GOOGLE] Avoid emitting duplicated weakref
@ 2013-06-09 3:30 Dehao Chen
2013-06-09 3:31 ` Xinliang David Li
0 siblings, 1 reply; 4+ messages in thread
From: Dehao Chen @ 2013-06-09 3:30 UTC (permalink / raw)
To: GCC Patches; +Cc: David Li
This patch fixes a bug when two weakref symbols are mapped to a same
assembler name.
Testing on going.
OK for google branches if test is fine?
Thanks,
Dehao
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c (revision 199844)
+++ gcc/varasm.c (working copy)
@@ -5502,6 +5502,10 @@ do_assemble_alias (tree decl, tree target)
if (TREE_ASM_WRITTEN (decl))
return;
+ if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))
+ && TREE_ASM_WRITTEN (DECL_ASSEMBLER_NAME (decl)))
+ return;
+
/* We must force creation of DECL_RTL for debug info generation, even though
we don't use it here. */
make_decl_rtl (decl);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GOOGLE] Avoid emitting duplicated weakref
2013-06-09 3:30 [GOOGLE] Avoid emitting duplicated weakref Dehao Chen
@ 2013-06-09 3:31 ` Xinliang David Li
2013-06-11 9:09 ` Bernhard Reutner-Fischer
0 siblings, 1 reply; 4+ messages in thread
From: Xinliang David Li @ 2013-06-09 3:31 UTC (permalink / raw)
To: Dehao Chen; +Cc: GCC Patches
Guard also with L_IPO_COMP_MODE as this is lipo specific.
David
On Sat, Jun 8, 2013 at 8:29 PM, Dehao Chen <dehao@google.com> wrote:
> This patch fixes a bug when two weakref symbols are mapped to a same
> assembler name.
>
> Testing on going.
>
> OK for google branches if test is fine?
>
> Thanks,
> Dehao
>
> Index: gcc/varasm.c
> ===================================================================
> --- gcc/varasm.c (revision 199844)
> +++ gcc/varasm.c (working copy)
> @@ -5502,6 +5502,10 @@ do_assemble_alias (tree decl, tree target)
> if (TREE_ASM_WRITTEN (decl))
> return;
>
> + if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))
> + && TREE_ASM_WRITTEN (DECL_ASSEMBLER_NAME (decl)))
> + return;
> +
> /* We must force creation of DECL_RTL for debug info generation, even though
> we don't use it here. */
> make_decl_rtl (decl);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GOOGLE] Avoid emitting duplicated weakref
2013-06-09 3:31 ` Xinliang David Li
@ 2013-06-11 9:09 ` Bernhard Reutner-Fischer
2013-06-11 9:23 ` Jan Hubicka
0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Reutner-Fischer @ 2013-06-11 9:09 UTC (permalink / raw)
To: Xinliang David Li; +Cc: Dehao Chen, GCC Patches, Jan Hubicka, Joseph S. Myers
On 9 June 2013 05:31, Xinliang David Li <davidxl@google.com> wrote:
> Guard also with L_IPO_COMP_MODE as this is lipo specific.
Sounds like this is the LIPO incarnation of http://gcc.gnu.org/PR31537
See the patch at http://gcc.gnu.org/PR31537#c9 for not adding the
alias in the first place (back then, honza may have changed that
recently on trunk).
Honza, Joseph,
Are there rules for handling weakrefs in some standard? If so, which ones?
Just curious..
Thanks,
>
> David
>
> On Sat, Jun 8, 2013 at 8:29 PM, Dehao Chen <dehao@google.com> wrote:
>> This patch fixes a bug when two weakref symbols are mapped to a same
>> assembler name.
>>
>> Testing on going.
>>
>> OK for google branches if test is fine?
>>
>> Thanks,
>> Dehao
>>
>> Index: gcc/varasm.c
>> ===================================================================
>> --- gcc/varasm.c (revision 199844)
>> +++ gcc/varasm.c (working copy)
>> @@ -5502,6 +5502,10 @@ do_assemble_alias (tree decl, tree target)
>> if (TREE_ASM_WRITTEN (decl))
>> return;
>>
>> + if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))
>> + && TREE_ASM_WRITTEN (DECL_ASSEMBLER_NAME (decl)))
>> + return;
>> +
>> /* We must force creation of DECL_RTL for debug info generation, even though
>> we don't use it here. */
>> make_decl_rtl (decl);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GOOGLE] Avoid emitting duplicated weakref
2013-06-11 9:09 ` Bernhard Reutner-Fischer
@ 2013-06-11 9:23 ` Jan Hubicka
0 siblings, 0 replies; 4+ messages in thread
From: Jan Hubicka @ 2013-06-11 9:23 UTC (permalink / raw)
To: Bernhard Reutner-Fischer
Cc: Xinliang David Li, Dehao Chen, GCC Patches, Jan Hubicka, Joseph S. Myers
> On 9 June 2013 05:31, Xinliang David Li <davidxl@google.com> wrote:
> > Guard also with L_IPO_COMP_MODE as this is lipo specific.
>
> Sounds like this is the LIPO incarnation of http://gcc.gnu.org/PR31537
>
> See the patch at http://gcc.gnu.org/PR31537#c9 for not adding the
> alias in the first place (back then, honza may have changed that
> recently on trunk).
>
> Honza, Joseph,
> Are there rules for handling weakrefs in some standard? If so, which ones?
Not that I would know of. It is an extension engineered for glibc pthreads. in
mainline I quite changed way weakrefs are handled and I still plan to do more.
What LTO does now is to handle weakref symbol as static symbol despite it has
DECL_EXTERNAL on it. (I have patch in queue to really make it static).
This is because the symbol never hits the exported symbol table anyhow.
I.e. you can have:
cat f1.i
static __gthrw_pthread_once __attribute__ ((__weakref__ ("pthread_once")));
$ cat f2.i
static __gthrw_pthread_once __attribute__ ((__weakref__ ("comething_completely_else")));
that will break with your do_assemble_alias change. with LTO you will now get
__gthrw_pthread_once.1 and __gthrw_pthread_once.2 with proper weakref targets.
Honza
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-11 9:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-09 3:30 [GOOGLE] Avoid emitting duplicated weakref Dehao Chen
2013-06-09 3:31 ` Xinliang David Li
2013-06-11 9:09 ` Bernhard Reutner-Fischer
2013-06-11 9:23 ` Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).