Skip to content

Commit 43e9eae

Browse files
authored
[BOLT] Preserve label annotations for injected functions (#68713)
Needed for instrumentation on RISC-V.
1 parent da37139 commit 43e9eae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bolt/lib/Passes/BinaryPasses.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,11 @@ void LowerAnnotations::runOnFunctions(BinaryContext &BC) {
619619
}
620620
for (BinaryFunction *BF : BC.getInjectedBinaryFunctions())
621621
for (BinaryBasicBlock &BB : *BF)
622-
for (MCInst &Instruction : BB)
622+
for (MCInst &Instruction : BB) {
623+
if (auto Label = BC.MIB->getLabel(Instruction))
624+
PreservedLabelAnnotations.emplace_back(&Instruction, *Label);
623625
BC.MIB->stripAnnotations(Instruction);
626+
}
624627

625628
// Release all memory taken by annotations
626629
BC.MIB->freeAnnotations();

0 commit comments

Comments
 (0)