[PATCH] D65388: [llvm-readelf/llvm-readobj] - Test the case when e_shstrndx==SHN_XINDEX, but sec[0].sh_link is broken.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 06:50:18 PDT 2019


grimar added a comment.

In D65388#1606137 <https://reviews.llvm.org/D65388#1606137>, @jhenderson wrote:

> It seems to me like the code here and the equivalent code in D65391 <https://reviews.llvm.org/D65391> are basically identical and should be deduplicated, to avoid the need for two different test cases. Could you merge the two, by adding a "CheckType" parameter or similar to the getSectionName code in ELF.h? I was completely independently looking at this myself, after running into an issue with this code relating to some local patches we have, caused by the code duplication.


This duplication was introduced in D63266 <https://reviews.llvm.org/D63266>. The intention was to skip non-critical errors to allow readelf to dump things.
I though about this and possible similar situations today too, btw. My idea was to add some kind of error policy for stuff in ELF.h.
For example `ERR_MODE_STRICT` which would act as now, reporting everything, and mode `ERR_MODE_DUMP` which dumpers and tools
like `obj2yaml` could use (`obj2yaml` can win from relaxing the error checking a lot).
I had no chance to investigate this, can take a look closer tomorrow.


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

https://reviews.llvm.org/D65388





More information about the llvm-commits mailing list