Skip to content

Commit abe34ce

Browse files
committed
[Pseudo Probe] Remove the assert of allowing only one call probe for a callsite.
Compiler-generated static symbols, such as the global initializers, can shared the same name and can coexist in the binary. As a result, their pseudo probes are all kept in the binary too. This could cause multiple call probes decoded against one callsite, as probes are decoded against there owning functions by name. I'm temporarily disabling an assert to keep the debug build green until we have a better fix. Reviewed By: wenlei Differential Revision: https://reviews.llvm.org/D153588
1 parent 7ba9506 commit abe34ce

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

llvm/lib/MC/MCPseudoProbe.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,20 @@ MCPseudoProbeDecoder::getCallProbeForAddr(uint64_t Address) const {
584584
const MCDecodedPseudoProbe *CallProbe = nullptr;
585585
for (const auto &Probe : Probes) {
586586
if (Probe.isCall()) {
587-
assert(!CallProbe &&
588-
"There should be only one call probe corresponding to address "
589-
"which is a callsite.");
587+
// Disabling the assert and returning first call probe seen so far.
588+
// Subsequent call probes, if any, are ignored. Due to the the way
589+
// .pseudo_probe section is decoded, probes of the same-named independent
590+
// static functions are merged thus multiple call probes may be seen for a
591+
// callsite. This should only happen to compiler-generated statics, with
592+
// -funique-internal-linkage-names where user statics get unique names.
593+
//
594+
// TODO: re-enable or narrow down the assert to static functions only.
595+
//
596+
// assert(!CallProbe &&
597+
// "There should be only one call probe corresponding to address "
598+
// "which is a callsite.");
590599
CallProbe = &Probe;
600+
break;
591601
}
592602
}
593603
return CallProbe;

0 commit comments

Comments
 (0)