Skip to content

Commit 40d9561

Browse files
committed
InstrProfilingMerge.c: Fix potential misalignment in SrcBitmapStart
Currently it is not an issue. It will be a problem if Bitmap is located after single byte counters.
1 parent 5bcc66d commit 40d9561

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler-rt/lib/profile/InstrProfilingMerge.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
154154
SrcCountersStart = (char *)SrcDataEnd;
155155
SrcCountersEnd = SrcCountersStart +
156156
Header->NumCounters * __llvm_profile_counter_entry_size();
157-
SrcBitmapStart = SrcCountersEnd;
157+
SrcBitmapStart = SrcCountersEnd + __llvm_profile_get_num_padding_bytes(
158+
SrcCountersEnd - SrcCountersStart);
158159
SrcNameStart = SrcBitmapStart + Header->NumBitmapBytes;
159160
SrcValueProfDataStart =
160161
SrcNameStart + getDistanceFromCounterToValueProf(Header);

0 commit comments

Comments
 (0)