This starts using reportUniqueWarnings instead of reportError
in the code that is responsible for dumping notes.
Details
Diff Detail
Event Timeline
llvm/test/tools/llvm-readobj/ELF/gnu-notes.test | ||
---|---|---|
121 | The mention of the "SHT_NOTE section [index 1]" happens twice redundantly. Same issue with the program header below. Do you think we could omit some of this redudant context? |
llvm/test/tools/llvm-readobj/ELF/gnu-notes.test | ||
---|---|---|
121 | The problem is that on one situations notes might report the section index and type: Elf_Note_Iterator notes_begin(const Elf_Phdr &Phdr, Error &Err) const { assert(Phdr.p_type == ELF::PT_NOTE && "Phdr is not of type PT_NOTE"); ErrorAsOutParameter ErrAsOutParam(&Err); if (Phdr.p_offset + Phdr.p_filesz > getBufSize()) { Err = createError("PT_NOTE header has invalid offset (0x" + Twine::utohexstr(Phdr.p_offset) + ") or size (0x" + Twine::utohexstr(Phdr.p_filesz) + ")"); return Elf_Note_Iterator(Err); } return Elf_Note_Iterator(base() + Phdr.p_offset, Phdr.p_filesz, Err); } but in other situations the note iterator might report an error on its own without a context: class Elf_Note_Iterator_Impl : std::iterator<std::forward_iterator_tag, Elf_Note_Impl<ELFT>> { // Stop iteration and indicate an overflow. void stopWithOverflowError() { Nhdr = nullptr; *Err = make_error<StringError>("ELF note overflows container", object_error::parse_failed); } Perhaps, the best solution would be to stop reporting section index/type in Object/ELF.h/notes_begin(). I'll suggest a patch tomorrow. |
The mention of the "SHT_NOTE section [index 1]" happens twice redundantly. Same issue with the program header below. Do you think we could omit some of this redudant context?