This is an archive of the discontinued LLVM Phabricator instance.

Coverage: Document how to collect a profile without a filesystem
ClosedPublic

Authored by dexonsmith on Apr 21 2021, 3:06 PM.

Details

Summary

The profiling runtime was designed to work without static initializers
or a a filesystem (see 117cf2bd1ff585f9754b5f30f5a4cfd65b230bbf and
others). The no-static-initializers part was already documented but this
part got missed before.

Diff Detail

Event Timeline

dexonsmith requested review of this revision.Apr 21 2021, 3:06 PM
dexonsmith created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2021, 3:06 PM
vsk added a subscriber: efriedma.Apr 21 2021, 3:33 PM

Thanks for doing this!

+ Eli to comment on whether any workarounds documented in https://lists.llvm.org/pipermail/llvm-dev/2017-September/117156.html are still necessary. To my knowledge it's not currently necessary to explicitly pass -mllvm -enable-value-profiling=false (as value profiling should not be enabled under -fcoverage-mapping -fprofile-instr-generate). It should also not be necessary to shave .o's out of the runtime static archive; so long as the static initializer isn't linked, the linker shouldn't pull in any references to malloc, mmap, etc.

clang/docs/SourceBasedCodeCoverage.rst
368

I think we should leave a note about how to avoid pulling in unwanted symbol references, and perhaps reference the preceding section about using the runtime without its static initializer.

Incorporate feedback from @vsk:

  • a bit more explanatory text for the overall context
  • explicitly reference the static initializers
dexonsmith marked an inline comment as done.Apr 21 2021, 4:28 PM
dexonsmith added inline comments.
clang/docs/SourceBasedCodeCoverage.rst
368

Improved this a bit; let me know if you suggested text that makes the unwanted symbol reference stuff a bit more clear.

Note, BTW, that I've made this a sub-section of "Using the profiling runtime without static initializers"; if you think it should be a peer section that's an option too.

vsk accepted this revision.Apr 22 2021, 10:27 AM

This looks great, thanks.

This revision is now accepted and ready to land.Apr 22 2021, 10:27 AM
This revision was landed with ongoing or failed builds.Apr 22 2021, 11:30 AM
This revision was automatically updated to reflect the committed changes.
dexonsmith marked an inline comment as done.