[compiler-rt] [llvm] [Profile] Enable binary profile correlation for Mach-O binaries (PR #179937)

Marina Taylor via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 06:42:30 PST 2026


================
@@ -478,6 +498,16 @@ void BinaryInstrProfCorrelator<IntPtrT>::correlateProfileDataImpl(
     uint64_t CounterPtr = this->template maybeSwap<IntPtrT>(I->CounterPtr);
     uint64_t CountersStart = this->Ctx->CountersSectionStart;
     uint64_t CountersEnd = this->Ctx->CountersSectionEnd;
+    if (!this->Ctx->MachOFixups.empty()) {
+      uint64_t Offset = (uint64_t)&I->CounterPtr - (uint64_t)DataStart;
----------------
citymarina wrote:

Oh! - actually, this doesn't work, because the input to the mapping is an offset from the start of `__llvm_covdata`.

In other words, the code in the first patch was: `&I->CounterPtr` not `I->CounterPtr`.

I'm not sure how to undo the "accept suggestion" button so I'll just add a fixup that reverses it.

https://github.com/llvm/llvm-project/pull/179937


More information about the llvm-commits mailing list