[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 02:37:21 PDT 2019


grimar marked 2 inline comments as done.
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:
> ```
>       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?




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

https://reviews.llvm.org/D65215





More information about the llvm-commits mailing list