This is https://bugs.llvm.org/show_bug.cgi?id=42215.
GNU readelf allows to dump the objects in that case,
but llvm-readobj/llvm-readelf reports an error and stops.
The patch fixes that.
Differential D63074
[llvm-readobj/llvm-readelf] - Don't fail to dump the object if .dynsym has broken sh_link field. grimar on Jun 10 2019, 4:45 AM. Authored by
Details This is https://bugs.llvm.org/show_bug.cgi?id=42215. GNU readelf allows to dump the objects in that case, The patch fixes that.
Diff Detail Event Timeline
Comment Actions
Comment Actions LGTM, with one remaining suggestion.
|
I'm a little uncomfortable with this interface. unwrapOrWarn implies that you'll get a warning or an object, yet you actually end up with both, with the latter being default constructed. However, not all objects are default constructible, meaning that this function can't be called for those types. Furthermore, the default type must be something that can be handled further on in the code correctly (imagine how easy it would be for a crash if the return type was a pointer). I think that way lies the risk of bugs. I'd suggest following the more traditional Expected behaviour, something like this:
In a StringRef case, what you're doing is fine, as long as an empty StringRef makes sense further down, but that's not always the case.