[PATCH] D110188: [compiler-rt][profile] Add padding after binary IDs
Leonard Chan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 23 10:30:46 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6bc9c8dfe32c: [compiler-rt][profile] Add padding after binary IDs (authored by leonardchan).
Changed prior to commit:
https://reviews.llvm.org/D110188?vs=374400&id=374613#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110188/new/
https://reviews.llvm.org/D110188
Files:
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
Index: compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
===================================================================
--- compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
+++ compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
@@ -142,7 +142,9 @@
/*
* Helper function that iterates through notes section and find build ids.
- * If writer is given, write binary ids into profiles.
+ * If writer is given, write binary ids into profiles. This also takes into
+ * account padding which may need to be added after the binary IDs to ensure
+ * 8-byte alignment.
* If an error happens while writing, return -1.
*/
static int WriteBinaryIds(ProfDataWriter *Writer, const ElfW(Nhdr) * Note,
@@ -160,7 +162,17 @@
Note = (const ElfW(Nhdr) *)((const char *)(Note) + NoteOffset);
}
- return TotalBinaryIdsSize;
+ uint8_t BinaryIdsPadding =
+ __llvm_profile_get_num_padding_bytes(TotalBinaryIdsSize);
+ if (Writer) {
+ ProfDataIOVec BinaryIdIOVec[] = {
+ {NULL, sizeof(uint8_t), BinaryIdsPadding, 1}};
+ if (Writer->Write(Writer, BinaryIdIOVec,
+ sizeof(BinaryIdIOVec) / sizeof(*BinaryIdIOVec)))
+ return -1;
+ }
+
+ return TotalBinaryIdsSize + BinaryIdsPadding;
}
/*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110188.374613.patch
Type: text/x-patch
Size: 1246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210923/a4d66ace/attachment.bin>
More information about the llvm-commits
mailing list