Our group has worked on adding llvm-cov
support for Linux and Xen. These freestanding systems cannot easily use the existing coverage definitions and code (e.g., InstrProfilingBuffer.c) because they are not linked with compiler-rt
, thus requiring redefinition of relevant data structures and reimplementation of data writing to disk (dump() in Xen, llvm_cov_serialize_raw_profile()
in Linux PATCH v2 1/4). The key issue with reimplementation is that it must be updated whenever the LLVM Profile version changes (e.g., update v4 to v10).
A potential solution would be to generalize the LLVM definitions (InstrProfData.inc) to support multiple versions simultaneously (rather than only the latest version), e.g., using #ifdef
-sprinkled code to accommodate the current version plus several previous versions. This change would make it easier for Linux, Xen, and many embedded systems to simply copy-paste the code from LLVM and get all the latest updates. We understand that this change would come at a somewhat higher cost of maintainability for LLVM. A similar discussion was raised by Xen developers.
Would you be interested to explore this change? Should we prepare a draft patch to support multiple versions at once?