This is an archive of the discontinued LLVM Phabricator instance.

[coverage] covmap section can now be emitted as 'progbits' without alloc flag set
ClosedPublic

Authored by davidxl on Feb 16 2016, 4:19 PM.

Details

Summary

Historically, there were two problems with covmap section emission in LLVM: 1) the section is emitted with 'alloc' bit set, resulting in increased loadable segment size; 2) the covmap section would be removed by the linker if -gc-sections option is on (both gold and bfd linker)

In http://reviews.llvm.org/D16092, both issues were resolved, but in order to make BFD linker not GC covmap, the covmap section was also marked as a note section due to a different design choice between bfd ld and the gold linker.

Comment #8 in https://sourceware.org/bugzilla/show_bug.cgi?id=19446 has a good summary. Basically if a non-alloc section has a reference to another symbol which is not otherwise referenced, the linker will choose to discard the referencing section in order to garbage collect the other symbol. The linker will keep the section if there is no such references in the section (verified with 2.24 and 2.26).

At the time of that patch, the covmap has reference to the PGO name symbol thus we had the GC problem. Most recently, we have enabled name compression in LLVM for PGO/coverage, which means covmap no longer has references to other symbols and bfd linker will leave them alone without GC them. This means we no longer need to mark covmap section as SHT_NOTE.

Diff Detail

Repository
rL LLVM

Event Timeline

davidxl updated this revision to Diff 48121.Feb 16 2016, 4:19 PM
davidxl retitled this revision from to [coverage] covmap section can now be emitted as 'progbits' without alloc flag set.
davidxl updated this object.
davidxl added reviewers: vsk, davidb.
davidxl added a subscriber: llvm-commits.
davidb edited edge metadata.Feb 17 2016, 3:11 AM

LGTM, thanks for the quick response on this!

This revision was automatically updated to reflect the committed changes.