MaskRay added a comment.

> There are also going to be binaries in our system build that don't use foo.h 
> and ideally shouldn't have any overhead since nothing inside them is 
> instrumented (they should behave as if -fprofile-instr-generate wasn't set 
> for them at all). That's not the case today because if you set 
> -fprofile-instr-generate, driver passes -u__llvm_profile_runtime to the 
> linker which "pulls in" the profile runtime introducing some extra bloat and 
> startup overhead I described earlier.

The overhead is just `__llvm_profile_write_file`, right? It just writes a 100+ 
bytes file which has very little overhead.

Some sanitizers can be used in a link-only manner without instrumentation, e.g. 
`-fsanitize=leak` does not need instrumentation. The source code just loses 
`__has_feature(leak_sanitizer)` detection. 
Link-only `-fsanitize=address` can catch double free and mismatching new/delete.

Do we expect that libclang_rt.profile- can provide other features which may be 
useful even if there is nothing to instrument according to `-fprofile-list`?
If yes, making the library conditionally not linked can lose such features.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98061/new/

https://reviews.llvm.org/D98061

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to