[PATCH] D82883: [LLD][COFF] Deduplicate .pdata entries

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 08:18:55 PDT 2020


aganea marked an inline comment as done.
aganea added a comment.

@mstorsjo This happens on VS2019 libs. I don't know if this happens on VS2017. I don't have an exact repro, but the test below exhibits the same effect as the problem I was observing. I will dig more into this.



================
Comment at: lld/COFF/Writer.cpp:1869
+    // the PE image, but that should be fine.
+    memset(end - removed, 0, removed * sizeof(Entry));
+
----------------
mstorsjo wrote:
> Would it be possible to adjust the virtual size of the .pdata section as well, to exclude the pruned bits? I could imagine that some runtime introspection tools locate the section directly instead of using the data directory.
Unfortunately the .pdata is merged into .rdata, there're other things following the merged .pdata in the output, and at this point all the RVAs have been calculated and sections already merged & written.

I've tried pruning earlier, but it's a tail biting snake. We need the entire merged, reallocated & sorted .pdata stream, and the computed RVAs, but we don't have that unless all sections have been written. But once they're written, we can't prune them, unless we would re-write again.

If we did a two-step "writeSection" and perhaps computed everything in advance, before writing, it could maybe be possible to resize the output section, but that would involve some sizeable refactoring. I figured it wasn't worth it, but if anyone has a different view on this, please let me know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82883





More information about the llvm-commits mailing list