commit edea3631e2c1cd49c93f6fff883fea2affdfa2d1 Author: Konstantin Zhuravlyov Date: Wed May 10 15:52:09 2023 -0400 Update getDesc* functions due to 689715fx Change-Id: I0e8058ceb8a04550fe6c17d74babcf5fe0ee609d diff --git a/src/comgr-metadata.cpp b/src/comgr-metadata.cpp index a3375b4..72aeb01 100644 --- a/src/comgr-metadata.cpp +++ b/src/comgr-metadata.cpp @@ -223,7 +223,7 @@ static bool mergeNoteRecords(llvm::msgpack::DocNode &From, template static bool processNote(const Elf_Note &Note, DataMeta *MetaP, llvm::msgpack::DocNode &Root) { - auto DescString = Note.getDescAsStringRef(); + auto DescString = Note.getDescAsStringRef(4); if (Note.getName() == "AMD" && Note.getType() == ELF::NT_AMD_HSA_METADATA) { @@ -557,7 +557,7 @@ getElfIsaNameFromElfNotes(const ELFObjectFile *Obj, switch (Note.getType()) { case ELF::NT_AMD_HSA_CODE_OBJECT_VERSION: { - if (Note.getDesc().size() < + if (Note.getDesc(4).size() < sizeof(amdgpu_hsa_note_code_object_version_s)) { IsError = true; return true; @@ -565,7 +565,7 @@ getElfIsaNameFromElfNotes(const ELFObjectFile *Obj, const auto *NoteCodeObjectVersion = reinterpret_cast( - Note.getDesc().data()); + Note.getDesc(4).data()); // Only code objects up to version 2 used note records. if (NoteCodeObjectVersion->major_version > 2) { @@ -578,7 +578,7 @@ getElfIsaNameFromElfNotes(const ELFObjectFile *Obj, } case ELF::NT_AMD_HSA_HSAIL: { - if (Note.getDesc().size() < sizeof(amdgpu_hsa_note_hsail_s)) { + if (Note.getDesc(4).size() < sizeof(amdgpu_hsa_note_hsail_s)) { IsError = true; return true; } @@ -588,21 +588,21 @@ getElfIsaNameFromElfNotes(const ELFObjectFile *Obj, } case ELF::NT_AMD_HSA_ISA_VERSION: { - if (Note.getDesc().size() < + if (Note.getDesc(4).size() < offsetof(amdgpu_hsa_note_isa_s, vendor_and_architecture_name)) { IsError = true; return true; } const auto *NoteIsa = reinterpret_cast( - Note.getDesc().data()); + Note.getDesc(4).data()); if (!NoteIsa->vendor_name_size || !NoteIsa->architecture_name_size) { IsError = true; return true; } - if (Note.getDesc().size() < + if (Note.getDesc(4).size() < offsetof(amdgpu_hsa_note_isa_s, vendor_and_architecture_name) + NoteIsa->vendor_name_size + NoteIsa->architecture_name_size) { IsError = true;