This is an archive of the discontinued LLVM Phabricator instance.

[llvm-cov] Fix llvm-cov on Windows and un-XFAIL test
ClosedPublic

Authored by rnk on Feb 25 2019, 5:56 PM.

Details

Summary

The llvm-cov tool needs to be able to find coverage names in the
executable, so the .lprfn and .lcovmap sections cannot be merged into
.rdata.

Also, the linker merges .lprfn$M into .lprfn, so llvm-cov needs to
handle that when looking up sections. It has to support running on both
relocatable object files and linked PE files.

Lastly, when loading .lprfn from a PE file, llvm-cov needs to skip the
leading zero byte added by the profile runtime.

Diff Detail

Event Timeline

rnk created this revision.Feb 25 2019, 5:56 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 25 2019, 5:56 PM
Herald added subscribers: Restricted Project, hiraditya. · View Herald Transcript
vsk added a comment.Feb 25 2019, 6:14 PM

I suppose Names{Start,End} are needed on Windows so that we can find section boundaries.

Thanks, lgtm.

vsk accepted this revision.Feb 25 2019, 6:14 PM
This revision is now accepted and ready to land.Feb 25 2019, 6:14 PM
rnk added a comment.Feb 25 2019, 6:19 PM
In D58661#1410041, @vsk wrote:

I suppose Names{Start,End} are needed on Windows so that we can find section boundaries.

Yep. Along the way I tried this creative code pattern, which works with clang but not MSVC:

const char COMPILER_RT_SECTION(".lprfn$A") NamesStart[0] = {};
const char COMPILER_RT_SECTION(".lprfn$Z") NamesEnd[0] = {};

Thanks, lgtm.

Thanks!

This revision was automatically updated to reflect the committed changes.