[PATCH] D126898: [COFF] Check table ptr more thoroughly and ignore empty sections

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 19:59:22 PDT 2022


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: llvm/lib/Object/COFFObjectFile.cpp:902
+    if (E.isA<SectionStrippedError>())
+      consumeError(std::move(E));
+    else
----------------
mstorsjo wrote:
> The patch overall looks reasonable to me. The changes to this function feel a bit clunky, but I don't really have any other good suggestions either.
> 
> @rnk, what do you think about this patch?
To make it less clunky, I can suggest making a wrapper which consumes stripped section errors, and then call it like:
```
static Error ignoreStrippedErrors(Error E) {
  if (E.isA<...>()) {
    consumeError(...);
    return Error::success();
  }
  return std::move(E);
}

...
  if (Error E = ignoreStrippedErrors(initDelayImportTablePtr()))
    return E;
...
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126898



More information about the llvm-commits mailing list