Skip to content

Commit 8eb61d9

Browse files
authored
[SHT_LLVM_BB_ADDR_MAP] Cleanup old version support code from ELF.cpp.
This change was mistakenly dropped from the prior commit 6b623a6
1 parent 274152c commit 8eb61d9

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

llvm/lib/Object/ELF.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -885,9 +885,7 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
885885
for (uint32_t BlockIndex = 0; !MetadataDecodeErr && !ULEBSizeErr &&
886886
Cur && (BlockIndex < NumBlocksInBBRange);
887887
++BlockIndex) {
888-
uint32_t ID = Version >= 2
889-
? readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr)
890-
: BlockIndex;
888+
uint32_t ID = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
891889
uint32_t Offset = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
892890
// Read the callsite offsets.
893891
uint32_t LastCallsiteOffset = 0;
@@ -907,19 +905,15 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
907905
uint32_t Size = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr) +
908906
LastCallsiteOffset;
909907
uint32_t MD = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
910-
if (Version >= 1) {
911-
// Offset is calculated relative to the end of the previous BB.
912-
Offset += PrevBBEndOffset;
913-
PrevBBEndOffset = Offset + Size;
914-
}
915908
Expected<BBAddrMap::BBEntry::Metadata> MetadataOrErr =
916909
BBAddrMap::BBEntry::Metadata::decode(MD);
917910
if (!MetadataOrErr) {
918911
MetadataDecodeErr = MetadataOrErr.takeError();
919912
break;
920913
}
921914
BBEntries.push_back(
922-
{ID, Offset, Size, *MetadataOrErr, CallsiteOffsets});
915+
{ID, Offset + PrevBBEndOffset, Size, *MetadataOrErr, CallsiteOffsets});
916+
PrevBBEndOffset += Offset + Size;
923917
}
924918
TotalNumBlocks += BBEntries.size();
925919
}

0 commit comments

Comments
 (0)