Imagine we have object that has .shstrtab with type != SHT_STRTAB.
In this case, we fail to dump the object, though GNU readelf dumps it without
any issues and warnings.
This patch fixes that. It adds a code to ELFDumper.cpp which is based on the implementation of getSectionName from the ELF.h:
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Object/ELF.h#L608
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Object/ELF.h#L431
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Object/ELF.h#L539
The difference is that all non critical errors are ommitted what allows us to
improve the dumping on a tool side. Also, this opens a road for a follow-up that
should allow us to dump the section headers, but drop the section names in case if .shstrtab is completely absent and/or broken.
Could this call reportError(Twine) at least? Ideally, I'd prefer it if it called a function that included the file name too. I think there's one in llvm-readobj.cpp that would be useful: reportError(StringRef Input, Error Err). I don't see a reason that this couldn't be exposed to the rest of llvm-readobj.