[PATCH] D110277: [compiler-rt][profile] Account for binary IDs size in test
Leonard Chan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 22 15:50:28 PDT 2021
leonardchan updated this revision to Diff 374389.
leonardchan retitled this revision from "[compiler-rt][profile] Do not emit binary IDs for corrupted-profile.c test" to "[compiler-rt][profile] Account for binary IDs size in test".
leonardchan edited the summary of this revision.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110277/new/
https://reviews.llvm.org/D110277
Files:
compiler-rt/test/profile/Linux/corrupted-profile.c
Index: compiler-rt/test/profile/Linux/corrupted-profile.c
===================================================================
--- compiler-rt/test/profile/Linux/corrupted-profile.c
+++ compiler-rt/test/profile/Linux/corrupted-profile.c
@@ -42,10 +42,15 @@
if (Buf == MAP_FAILED)
bail("mmap");
+ // The binary IDs size is the 3rd uint64_t in the header. This size should
+ // already account for padding.
+ uint64_t BinaryIdsSize;
+ memcpy(&BinaryIdsSize, &Buf[2 * 8], sizeof(BinaryIdsSize));
+
// We're trying to make the first CounterPtr invalid.
// 11 64-bit words as header.
// CounterPtr is the third 64-bit word field.
- memset(&Buf[11 * 8 + 2 * 8], 0xAB, 8);
+ memset(&Buf[11 * 8 + BinaryIdsSize + 2 * 8], 0xAB, 8);
if (munmap(Buf, FileSize))
bail("munmap");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110277.374389.patch
Type: text/x-patch
Size: 826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210922/d1d6c0bd/attachment.bin>
More information about the llvm-commits
mailing list