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

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 14:36:38 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);
----------------
cjacek wrote:

Yes. I assumed that it's fine to depend on the buffer being initialized to zero (we already do in other places, as mentioned in #72138).

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


More information about the llvm-commits mailing list