[llvm-commits] [llvm] r157852 - /llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp

Nick Lewycky nicholas at mxc.ca
Fri Jun 1 21:34:23 PDT 2012


Bill Wendling wrote:
> Author: void
> Date: Fri Jun  1 18:14:32 2012
> New Revision: 157852
>
> URL: http://llvm.org/viewvc/llvm-project?rev=157852&view=rev
> Log:
> Register the gcov "writeout" at init time. Don't list this as a d'tor. Instead,
> inject some code in that will run via the "__mod_init_func" method that
> registers the gcov "writeout" function to execute at exit time.
>
> The problem is that the "__mod_term_func" method of specifying d'tors is
> deprecated on Darwin. And it can lead to some ambiguities when dealing with
> multiple libraries.

Why isn't @llvm.global_dtors doing what you want? Is it broken on 
Darwin? Is the bug that it was getting called when the .dylib is 
unloaded as opposed to at program exit?

The LangRef description of @llvm.global_dtors is wrong, it says "The 
functions referenced by this array will be called in descending order of 
priority (i.e. highest first) when the module is loaded." which is 
clearly copy+paste from the @llvm.global_ctors case; either it should be 
s/loaded/unloaded/ or s/module is loaded/program exits/ and that changes 
where the bug is. :)

Nick



More information about the llvm-commits mailing list