r204939 - InstrProf: Pull in runtime on non-Darwin
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Mar 28 11:18:45 PDT 2014
On 2014 Mar 28, at 08:45, Alexey Samsonov <samsonov at google.com> wrote:
> I've submitted the -whole-archive change as r205012.
>
>
> On Fri, Mar 28, 2014 at 11:42 AM, Kostya Serebryany <kcc at google.com> wrote:
> This does not help.
> For asan&co we solve the same problem by adding -whole-archive/-no-whole-archive around the library in the linker command.
>
> —kcc
I’ve now committed r205023, which I’m hoping is more portable. (Let me know if my
solution *still* doesn’t work on Linux.) As I mentioned in my review of r205012,
-whole-archive doesn’t quite solve the problem.
The main problem with -whole-archive is that any of the profiling options would
have (incorrectly) pulled in all of the profiling library.
A finer point (to be documented soon in llvm:docs/Something.rst) is that even when
-fprofile-instr-generate is specified, we don’t even want all of the instrumented
profiling library to be pulled in. The current design allows an advanced user to
give their own definition of __llvm_profile_runtime. Primarily, this avoids the
hook that registers writing to file with atexit(); an advanced user can call
__llvm_profile_write_file() directly. Secondarily, it allows the user to avoid
any dependencies on libc. The user can extract the data by calling
__llvm_profile_get_size_for_buffer(), allocating a buffer, and calling __llvm_profile_write_buffer().
More information about the cfe-commits
mailing list