[PATCH] D98061: [InstrProfiling] Generate runtime hook for ELF platforms
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 12 19:06:47 PST 2021
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
More information about the cfe-commits
mailing list