<div dir="ltr">This seems wrong for associative comdats.  Won't the comdat symbol necessarily be in a different section?<div><br></div><div>Also, I ran into some problems with our assembly parsing:</div><div><div><br></div>
<div>$ cat t.cpp</div><div>int foo();</div><div>template <typename T> struct Foo { static int x; };</div><div>template <typename T> int Foo<T>::x = foo();</div><div>int main() { return Foo<int>::x; }</div>
<div><br></div><div>$ clang -c t.cpp -S -o -  | llvm-mc -o t.s<br></div></div><div><div><stdin>:47:37: error: associated section must be a COMDAT section<br></div><div>        .section        .CRT$XCU,"rd",associative .bss,"?x@?$Foo@H@@2HA"</div>
</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 5, 2014 at 12:20 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We extended the .section syntax to allow multiple sections with the<br>
same name but different comdats, but currently we don't make sure that<br>
the output section has that comdat symbol.<br>
<br>
That happens to work with the code llc produces currently because it looks like<br>
<br>
.section secName, "dr", one_only, "COMDATSym"<br>
.globl COMDATSym<br>
COMDATSym:<br>
....<br>
<br>
but that is not very friendly to anyone coding in assembly or even to<br>
llc once we get comdat support in the IR.<br>
<br>
The attached patch changes the coff object writer to make sure the<br>
comdat symbol is output just after the section symbol, as required by<br>
the coff spec.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div>