<div dir="ltr">This might give some assemblers heartburn.  Does gcc sanitize the filename in any way?<div><br></div><div>What happens if the main source file is stdin?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Apr 25, 2014 at 4:17 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</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">Hi,<div><br></div><div>gcc calls the static initialization function for file foo.cc _GLOBAL__sub_i_foo.cc, while clang always uses _GLOBAL__I_a . Having the filename in the symbol is useful for finding where static initializers are from; we use this information in chromium on linux. (On Mac, we look at the dSYM file instead.)</div>

<div><br></div><div>The attached patch makes clang behave like gcc for initializers. (It doesn't change the behavior for __D_ functions, not sure if anyone wants that.)</div><div><br></div><div>Opinions? Is this useful for anyone else?</div>

<div><br></div><div>(Drawbacks: slightly longer symbols, which has a (small) binary size cost, and it looks like __attribute__ ((init_priority(101))) works by naming the _GLOBAL__ functions _GLOBAL__I_000101 etc, so if you call your source file 000101.cc it might interfere with this patch.</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>Nico</div></font></span></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">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></blockquote></div><br></div>