[PATCH] D65215: [obj2yaml] - Teach tool to dump SHT_NULL sections.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 03:35:46 PDT 2019


grimar added inline comments.


================
Comment at: tools/obj2yaml/elf2yaml.cpp:245
+      // normally creates the zero section at index 0 implicitly.
+      if (&Sec - &Sections[0] == 0) {
+        const uint8_t *Begin = reinterpret_cast<const uint8_t *>(&Sec);
----------------
MaskRay wrote:
> grimar wrote:
> > MaskRay wrote:
> > > ```
> > >       if (&Sec == &Sections[0] && memchr(&Sec, 0, sizeof Sec) == nullptr)
> > >         break;
> > > ```
> > `memchr` searches for the first `value`, e.g. for the first `0` in your sample.
> > But I want to check here that all bytes in a range are '0', i.e. I need
> > to find the first non-zero value, it doesn't seem `memchr` can help here?
> > 
> > 
> Sorry about the memchr suggestion.. This part looks good.
> 
> `if (&Sec == &Sections[0]) {`
Nevermind. I was also a bit confused about that there seems to be no any standart function for that.


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

https://reviews.llvm.org/D65215





More information about the llvm-commits mailing list