[LLD] [COFF] Fix crashes for cfguard with undefined weak symbols (#79063)
authorMartin Storsjö <martin@martin.st>
Tue, 23 Jan 2024 18:37:03 +0000 (20:37 +0200)
committerGitHub <noreply@github.com>
Tue, 23 Jan 2024 18:37:03 +0000 (20:37 +0200)
commit50d33c62ad8786400a712b01150f6decaf070782
treef07818407b43f68b13aa78de28e5c2c248b73829
parentbb8a8770e203ba027d141cd1200e93809ea66c8f
[LLD] [COFF] Fix crashes for cfguard with undefined weak symbols (#79063)

When marking symbols as having their address taken, we can have the
sitaution where we have the address taken of a weak symbol. If there's
no strong definition of the symbol, the symbol ends up as an absolute
symbol with the value null. In those cases, we don't have any Chunk.
Skip such symbols from the cfguard tables.

This fixes https://github.com/llvm/llvm-project/issues/78619.
lld/COFF/Writer.cpp
lld/test/COFF/cfguard-weak-undef.s [new file with mode: 0644]