Index: tools/llvm-readobj/ELFDumper.cpp =================================================================== --- tools/llvm-readobj/ELFDumper.cpp +++ tools/llvm-readobj/ELFDumper.cpp @@ -3367,7 +3367,8 @@ template static void printGNUNote(raw_ostream &OS, uint32_t NoteType, - ArrayRef::Elf_Word> Words) { + ArrayRef::Elf_Word> Words, + size_t Size) { switch (NoteType) { default: return; @@ -3390,16 +3391,14 @@ } case ELF::NT_GNU_BUILD_ID: { OS << " Build ID: "; - ArrayRef ID(reinterpret_cast(Words.data()), - Words.size() * 4); + ArrayRef ID(reinterpret_cast(Words.data()), Size); for (const auto &B : ID) OS << format_hex_no_prefix(B, 2); break; } case ELF::NT_GNU_GOLD_VERSION: OS << " Version: " - << StringRef(reinterpret_cast(Words.data()), - Words.size() * 4); + << StringRef(reinterpret_cast(Words.data()), Size); break; } @@ -3443,7 +3442,7 @@ if (Name == "GNU") { OS << getGNUNoteTypeName(Type) << '\n'; - printGNUNote(OS, Type, Descriptor); + printGNUNote(OS, Type, Descriptor, DescriptorSize); } else if (Name == "FreeBSD") { OS << getFreeBSDNoteTypeName(Type) << '\n'; } else {