[PATCH] D66734: [llvm-readobj/llvm-readelf] - Report a proper warning when dumping a broken dynamic relocation.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 08:00:38 PDT 2019


grimar marked 2 inline comments as done.
grimar added inline comments.


================
Comment at: include/llvm/Object/ELFTypes.h:251-255
+    return make_error<StringError>(
+        "st_name (0x" + utohexstr(Offset) +
+            ") is past the end of the string table of size 0x" +
+            utohexstr(StrTab.size()),
+        object_error::parse_failed);
----------------
MaskRay wrote:
> grimar wrote:
> > rupprecht wrote:
> > > nit: use `createStringError` w/ a format string
> > I think this what I initially did (used `createStringError`) , but it did not compile for me under linux (I am using windows for work most of the time), seems it wanted me to include a ELF.h header, but I was not sure it is a good idea to do that.
> > 
> > I'll revisit.
>     return createStringError(
>         object_error::parse_failed,
>         "st_name (0x" + utohexstr(Offset) +
>             ") is past the end of the string table of size 0x" +
>             utohexstr(StrTab.size()));
> 
> should work. createStringError is defined in include/llvm/Support/Error.h which is included
Yeah, I found that tried to use `createError` from 'ELF.h'. But createStringError works fine here.


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

https://reviews.llvm.org/D66734





More information about the llvm-commits mailing list