summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov
diff options
context:
space:
mode:
authorIgor Kudrin <ikudrin.dev@gmail.com>2016-05-18 07:43:27 +0000
committerIgor Kudrin <ikudrin.dev@gmail.com>2016-05-18 07:43:27 +0000
commiteb10307347fee33b9dda7a9567e6d69534d6040d (patch)
treed89f5358a199acf48351465f5f380d7aec29d9c2 /llvm/tools/llvm-cov
parent095fc41523134084d37f549bc1f89dbf95db5a73 (diff)
downloadbcm5719-llvm-eb10307347fee33b9dda7a9567e6d69534d6040d.tar.gz
bcm5719-llvm-eb10307347fee33b9dda7a9567e6d69534d6040d.zip
[Coverage] Ensure that coverage mapping data has an expected alignment in 'covmapping' files.
Coverage mapping data is organized in a sequence of blocks, each of which is expected to be aligned by 8 bytes. This feature is used when reading those blocks, see VersionedCovMapFuncRecordReader::readFunctionRecords(). If a misaligned covearge mapping data has more than one block, it causes llvm-cov to fail. Differential Revision: http://reviews.llvm.org/D20285 llvm-svn: 269887
Diffstat (limited to 'llvm/tools/llvm-cov')
-rw-r--r--llvm/tools/llvm-cov/TestingSupport.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-cov/TestingSupport.cpp b/llvm/tools/llvm-cov/TestingSupport.cpp
index f6c91f85c84..a662a155255 100644
--- a/llvm/tools/llvm-cov/TestingSupport.cpp
+++ b/llvm/tools/llvm-cov/TestingSupport.cpp
@@ -88,7 +88,11 @@ int convertForTestingMain(int argc, const char *argv[]) {
OS << "llvmcovmtestdata";
encodeULEB128(ProfileNamesData.size(), OS);
encodeULEB128(ProfileNamesAddress, OS);
- OS << ProfileNamesData << CoverageMappingData;
+ OS << ProfileNamesData;
+ // Coverage mapping data is expected to have an alignment of 8.
+ for (unsigned Pad = OffsetToAlignment(OS.tell(), 8); Pad; --Pad)
+ OS.write(uint8_t(0));
+ OS << CoverageMappingData;
return 0;
}
OpenPOWER on IntegriCloud