<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 25, 2014 at 4:33 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">This might give some assemblers heartburn. Does gcc sanitize the filename in any way?</div></blockquote><div><br></div><div>gcc apparently replaces spaces, '-, '+' etc with '_', so it does some sanitizing. ("test$2.cc" ends up being just "test.cc", so their sanitizing isn't complete.)</div>
<div><br></div><div>Does LLVM have a helper function that replaces possibly troubling characters with '_' characters?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>What happens if the main source file is stdin?</div>
</div></blockquote><div><br></div><div>gcc produces "_GLOBAL__sub_I_" (i.e. "nothing" for stdin). (My patch currently adds a "<stdin>", which seems suboptimal :-) ).</div><div><br></div>
<div>gcc apparently only does this in -fPIC mode too, not sure why.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>
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></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div>
<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><font color="#888888">
<div><br></div><div>Nico</div></font></span></div>
<br></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></blockquote></div><br></div>
</blockquote></div><br></div></div>