[cfe-dev] Linking ProfileRT when using -nodefaultlibs

Justin Bogner mail at justinbogner.com
Mon Nov 10 15:10:56 PST 2014


Alexey Samsonov <vonosmas at gmail.com> writes:
> Ah, I see the problem here.
>
> 1) We add profile runtime library after the linker inputs (in particular,
> after "-lc" provided by the user), because user-provided libraries can have
> references to libclang_rt.profile.a, and therefore should precede it.
> 2) If -nodefautlibs is there, we never add "-lc" and friends at the very end,
> so some symbols in profile runtime may be left unresolved.
>
> 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
> 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
> is not desirable, is it?

I believe -whole-archive will cause issues for the profile_rt library.
We really do only want particular symbols pulled in.



More information about the cfe-dev mailing list