Skip to content

Commit f483425

Browse files
authored
[BOLT] Reset output addresses for deleted blocks (#73429)
This is a follow-up to #73076. We need to reset output addresses for deleted blocks, otherwise the address translation may mistakenly attribute input address of a deleted block to a non-zero address. While working on a test case, I've discovered that DWARF output ranges were already broken for deleted basic blocks: #73428. I will provide a test case for this PR with a DWARF address range fix PR.
1 parent 1aa1d17 commit f483425

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4190,6 +4190,12 @@ void BinaryFunction::updateOutputValues(const BOLTLinker &Linker) {
41904190
? FF.getAddress() + FF.getImageSize()
41914191
: getOutputAddress() + getOutputSize());
41924192
}
4193+
4194+
// Reset output addresses for deleted blocks.
4195+
for (BinaryBasicBlock *BB : DeletedBasicBlocks) {
4196+
BB->setOutputStartAddress(0);
4197+
BB->setOutputEndAddress(0);
4198+
}
41934199
}
41944200

41954201
DebugAddressRangesVector BinaryFunction::getOutputAddressRanges() const {

0 commit comments

Comments
 (0)