<div dir="ltr">Should be fixed in r218337.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 23, 2014 at 3:01 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, it's globalopt. Here's the reduction:<div><br><div><div>$ cat t.ll</div><div>$comdat_global = comdat any</div><div>@comdat_global = weak_odr global i8 0, comdat $comdat_global</div><div>@simple_global = internal global i8 0</div><div>@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [</div><div> { i32, void ()*, i8* } { i32 65535, void ()* @init_comdat_global, i8* @comdat_global },</div><div> { i32, void ()*, i8* } { i32 65535, void ()* @init_simple_global, i8* null }</div><div>]</div><div>define void @init_comdat_global() {</div><div> store i8 42, i8* @comdat_global</div><div> ret void</div><div>}</div><div>define void @init_simple_global() comdat $comdat_global {</div><div> store i8 42, i8* @simple_global</div><div> ret void</div><div>}</div><div><br></div><div>$ opt t.ll -globalopt -S -o -</div><div>; ModuleID = 't.ll'</div><div><br></div><div>$comdat_global = comdat any</div><div><br></div><div>@comdat_global = weak_odr global i8 0, comdat $comdat_global</div><div>@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init_comdat_global, i8* null }]</div><div><br></div><div>define void @init_comdat_global() {</div><div> store i8 42, i8* @comdat_global</div><div> ret void</div><div>}</div><div><br></div><div>define void @init_simple_global() comdat $comdat_global {</div><div> ret void</div><div>}</div></div><div><br></div><div>Note the missing comdat field in global_ctors.</div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 23, 2014 at 11:52 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I reverted this. It needs more investigation. With optimizations enabled, I'm seeing a comdat group that looks like:<div><pre style="color:rgb(0,0,0)">COMDAT group section [ 2] `.group' [_ZN...kNameE] contains 4 sections:
[Index] Name
[ 43] .text.startup
[ 76] .bss._ZN...kNameE
[ 83] .bss._ZGV..kNameE
[ 44] .rela.text.startup</pre></div><div>Note that there is no .ctors section in the group. Maybe -globalopt fired?</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 22, 2014 at 9:39 PM, Anton Korobeynikov <span dir="ltr"><<a href="mailto:anton@korobeynikov.info" target="_blank">anton@korobeynikov.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yeah, the only difference between .ctors and .init_array is the order<br>
which the initializers are emitted in the section in.<br>
<br>
On Tue, Sep 23, 2014 at 4:58 AM, Rafael Avila de Espindola<br>
<span><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>> wrote:<br>
><br>
><br>
> Sent from my iPhone<br>
><br>
> On Sep 22, 2014, at 20:55, Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<br>
><br>
> On Mon, Sep 22, 2014 at 5:32 PM, Rafael Avila de Espindola<br>
> <<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>> wrote:<br>
>><br>
>><br>
>> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=218287&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=218287&view=rev</a><br>
>> > Log:<br>
>> > Don't use comdats for initializers on platforms that don't support it<br>
>> ><br>
>> > In particular, pre-.init_array ELF uses the .ctors section mechanism.<br>
>> > MinGW COFF also uses .ctors, now that I think about it.<br>
>><br>
>> Why doesn't it work with .ctors? It is just a list of pointers like<br>
>> .init_array.<br>
><br>
><br>
> I didn't think it was implemented. Are you saying it's possible and should<br>
> be easy, or that it should already work? We're having issues with my<br>
> favorite gold error, "relocation refers to discarded section".<br>
><br>
><br>
> I though I had implemented comdat in both .ctors and .init_array in the same<br>
> commit in LLVM.<br>
><br>
> Would you mind reporting a bug with a testcase that used to fail? I will<br>
> take a look as soon as I get back.<br>
><br>
> Thanks,<br>
> Rafael<br>
><br>
</span><div><div>> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
<br>
<br>
<br>
</div></div><span><font color="#888888">--<br>
With best regards, Anton Korobeynikov<br>
Faculty of Mathematics and Mechanics, Saint Petersburg State University<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>