Description
Bugzilla Link | 49155 |
Version | trunk |
OS | All |
CC | @vns-mn,@gulfemsavrun,@MaskRay,@rnk,@frobtech,@vedantk |
Extended Description
In the current coverage mapping format v5, we store mapping to together with the list of filename in the __llvm_covmap section. Since v4, the list of filenames can be also optionally zlib compressed.
The current format has one downside: there can be duplicate filenames in the list of filenames across translation units, in C/C++ this is especially likely for headers, but linker cannot deduplicate these.
This could be improved by adopting a solution similar to DWARF: we could store filenames in a separate mergeable strings section (SHF_MERGE|SHF_STRINGS in ELF), for example __llvm_covstr
. This would allow linker to deduplicate strings across translation units. We would also need to modify the coverage mapping to use offsets into the __llvm_covstr
section instead of indices.
The only downside of this approach is that we would be no longer able to compress the filenames. It's possible that the size reduction due to deduplication is going to be greater than the one from compression. This is something we should investigate and experiment with.
We could also consider teaching linkers how to automatically compress output sections as a generalization of the approach currently used for DWARF .debug_ sections (for example, when all input sections have the SHF_COMPRESSED
flag, the linker could automatically compress the output section).