<div dir="ltr"><div>><span style="font-family:arial,sans-serif;font-size:13px">Interesting. This issue doesn't arise with sanitizers, because we put sanitizer runtimes *before* the user inputs, and force it into the executable by wrapping it in "-whole-archive". I wonder if</span></div><div style="font-size:13px;font-family:arial,sans-serif">>we can do the same trick for profile runtime. I don't really know that, but it seems we have both GCDA profiling and new InstrProfiling stuff there, so pulling all of them into the executable</div><div style="font-size:13px;font-family:arial,sans-serif">>is not desirable, is it?</div><div style="font-size:13px;font-family:arial,sans-serif"><br></div><div style="font-size:13px;font-family:arial,sans-serif">I can't answer if we *should* do it put the profile runtime first, but I tested doing so and the change worked for me.</div><div style="font-size:13px;font-family:arial,sans-serif"><br></div><div style="font-size:13px;font-family:arial,sans-serif">>I believe -whole-archive will cause issues for the profile_rt library.</div><span style="font-family:arial,sans-serif;font-size:13px">>We really do only want particular symbols pulled in.</span><div style="font-size:13px;font-family:arial,sans-serif"><br></div><div style="font-size:13px;font-family:arial,sans-serif">How would I go about looking into this?</div><div style="font-size:13px;font-family:arial,sans-serif"><br></div><div style="font-size:13px;font-family:arial,sans-serif">/Eric</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 10, 2014 at 4:10 PM, Justin Bogner <span dir="ltr"><<a href="mailto:mail@justinbogner.com" target="_blank">mail@justinbogner.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Alexey Samsonov <<a href="mailto:vonosmas@gmail.com">vonosmas@gmail.com</a>> writes:<br>
> Ah, I see the problem here.<br>
><br>
> 1) We add profile runtime library after the linker inputs (in particular,<br>
> after "-lc" provided by the user), because user-provided libraries can have<br>
> references to libclang_rt.profile.a, and therefore should precede it.<br>
> 2) If -nodefautlibs is there, we never add "-lc" and friends at the very end,<br>
> so some symbols in profile runtime may be left unresolved.<br>
><br>
> Interesting. This issue doesn't arise with sanitizers, because we put<br>
> sanitizer runtimes *before* the user inputs, and force it into the executable<br>
> by wrapping it in "-whole-archive". I wonder if<br>
> we can do the same trick for profile runtime. I don't really know that, but it<br>
> seems we have both GCDA profiling and new InstrProfiling stuff there, so<br>
> pulling all of them into the executable<br>
> is not desirable, is it?<br>
<br>
</span>I believe -whole-archive will cause issues for the profile_rt library.<br>
We really do only want particular symbols pulled in.<br>
</blockquote></div><br></div>