[lld] [LLD][COFF] Keep hasData true in NullChunk constructor (PR #124368)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 25 12:21:59 PST 2025


mstorsjo wrote:

> In `NullChunk::writeTo`, we do write data using `memset`. However, we don't allocate space for that data in `Writer::assignAddresses`, meaning the pointer passed later to `writeTo` is invalid, it either points to the next section or beyond the allocated buffer.
> 
> To create behavior similar to `.bss`, we'd need to remove the `memset` call, but that's not what MSVC does. In most cases, this would save only 8 bytes, which doesn't seem worth diverging from MSVC. In the specific problematic ARM64X test, the entire auxiliary IAT consists only of null chunks, and the first one has a 0x1000 alignment, which could result in larger savings. However, this is a corner case.

Ok, I see. Yeah we don’t need to do this like bss; this should be fine if you just amend the commit message to explain that we do need to allocate actual space for it as we do memset it.

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


More information about the llvm-commits mailing list