[llvm] [BOLT][DWARF] Add support for DW_IDX_parent (PR #85285)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 12:17:23 PDT 2024
================
@@ -464,13 +502,33 @@ void DWARF5AcceleratorTable::writeEntries() {
for (auto &Bucket : getBuckets()) {
for (DWARF5AcceleratorTable::HashData *Hash : Bucket) {
Hash->EntryOffset = EntriesBuffer->size();
- for (const BOLTDWARF5AccelTableData *Value : Hash->Values) {
+ for (BOLTDWARF5AccelTableData *Value : Hash->Values) {
writeEntry(*Value);
}
support::endian::write(*Entriestream, static_cast<uint8_t>(0),
llvm::endianness::little);
}
}
+ // Patching parent offsets.
+ for (auto &Bucket : getBuckets()) {
+ for (DWARF5AcceleratorTable::HashData *Hash : Bucket) {
+ for (BOLTDWARF5AccelTableData *Entry : Hash->Values) {
+ std::optional<uint64_t> ParentOffset = Entry->getParentDieOffset();
+ if (!ParentOffset)
+ continue;
+ if (const auto Iter = EntryRelativeOffsets.find(*ParentOffset);
+ Iter != EntryRelativeOffsets.end()) {
+ const uint64_t PatchOffset = Entry->getPatchOffset();
+ uint32_t *Ptr = reinterpret_cast<uint32_t *>(
+ &EntriesBuffer.get()->data()[PatchOffset]);
+ *Ptr = Iter->second;
+ } else {
+ BC.errs() << "Could not find entry with offset " << *ParentOffset
----------------
maksfb wrote:
Is it a warning or an error and when can it get triggered? If the former, change the message to: "BOLT-WARNING: could not find...".
https://github.com/llvm/llvm-project/pull/85285
More information about the llvm-commits
mailing list