[PATCH] D64714: [Object/llvm-readelf/llvm-readobj] - Improve error reporting when e_shstrndx is broken.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 05:16:05 PDT 2019


grimar added a comment.

In D64714#1585186 <https://reviews.llvm.org/D64714#1585186>, @jhenderson wrote:

> I wonder if it would make sense if the file name was included in the error message, at least in the llvm-readobj/llvm-readelf case? In that case, there can be more than one file, or indeed it could be an archive member that is broken, so reporting the file name would make sense.


We shouldn't do this in ELF.h probably, since tools are adding it on their side. e.g. in `Invalid.test` I am actually testing the file name printed by obj2yaml.
And for example LLD expects that adds a error location (including file names) on it's side too.

Speaking about `llvm-readobj/llvm-readelf`, I do not mind, going to update the code in `ELFDumper.cpp` to add a file name.

> Aside from that, do we have a way yet of testing the e_shstrndx == SHN_XINDEX case yet for this error? I think that deserves its own test case once we do, so probably should have a TODO note somewhere around the relevant bits of code.

I believe obj2yaml/yaml2obj tool does not support the SHN_XINDEX (https://github.com/llvm-mirror/llvm/blob/master/lib/ObjectYAML/ELFYAML.cpp#L901) yet. I'll add such comments.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64714/new/

https://reviews.llvm.org/D64714





More information about the llvm-commits mailing list