Author: Gulfem Savrun Yeniceri Date: 2021-09-07T22:40:36-07:00 New Revision: 427df19c4791677a8e974bfeb8c09ab5b38bdbc3
URL: https://github.com/llvm/llvm-project/commit/427df19c4791677a8e974bfeb8c09ab5b38bdbc3 DIFF: https://github.com/llvm/llvm-project/commit/427df19c4791677a8e974bfeb8c09ab5b38bdbc3.diff LOG: Update counter offset to account for binary ids In the raw profile, binary ids immediately follow the header so when computing counters offset we need to account for the new section. (cherry picked from commit 8111f2f7eef50f8c0cdfd4b575e275c0c4b7fc41) Added: Modified: compiler-rt/lib/profile/InstrProfilingFile.c compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c Removed: ################################################################################ diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index 32def21eec7f..2e91f16a2158 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -657,8 +657,9 @@ static void initializeProfileForContinuousMode(void) { const uint64_t *CountersBegin = __llvm_profile_begin_counters(); const uint64_t *CountersEnd = __llvm_profile_end_counters(); uint64_t DataSize = __llvm_profile_get_data_size(DataBegin, DataEnd); - const uint64_t CountersOffset = - sizeof(__llvm_profile_header) + (DataSize * sizeof(__llvm_profile_data)); + const uint64_t CountersOffset = sizeof(__llvm_profile_header) + + __llvm_write_binary_ids(NULL) + + (DataSize * sizeof(__llvm_profile_data)); int Length = getCurFilenameLength(); char *FilenameBuf = (char *)COMPILER_RT_ALLOCA(Length + 1); diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c b/compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c index 0146b14c193f..1be0ef36a288 100644 --- a/compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c +++ b/compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c @@ -119,8 +119,9 @@ void __llvm_profile_initialize(void) { const uint64_t *CountersBegin = __llvm_profile_begin_counters(); const uint64_t *CountersEnd = __llvm_profile_end_counters(); const uint64_t DataSize = __llvm_profile_get_data_size(DataBegin, DataEnd); - const uint64_t CountersOffset = - sizeof(__llvm_profile_header) + (DataSize * sizeof(__llvm_profile_data)); + const uint64_t CountersOffset = sizeof(__llvm_profile_header) + + __llvm_write_binary_ids(NULL) + + (DataSize * sizeof(__llvm_profile_data)); uint64_t CountersSize = CountersEnd - CountersBegin; /* Don't publish a VMO if there are no counters. */ _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits