[lld] [LLD][COFF] Append a terminator entry to redirection metadata (PR #115202)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 12:03:25 PST 2024


================
@@ -1083,7 +1083,8 @@ void CHPECodeRangesChunk::writeTo(uint8_t *buf) const {
 }
 
 size_t CHPERedirectionChunk::getSize() const {
-  return exportThunks.size() * sizeof(chpe_redirection_entry);
+  // Add an extra +1 for a terminator entry.
+  return (exportThunks.size() + 1) * sizeof(chpe_redirection_entry);
----------------
mstorsjo wrote:

So this allocates a larger section for this, which gets zero initialized, while we only write the same area of it as before?

https://github.com/llvm/llvm-project/pull/115202


More information about the llvm-commits mailing list