diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 919afc7a6e0e2..aa5e8675dd313 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -712,6 +712,9 @@ bool GotSection::isNeeded() const { } void GotSection::writeTo(uint8_t *buf) { + // On PPC64 .got may be needed but empty. Skip the write. + if (size == 0) + return; target->writeGotHeader(buf); relocateAlloc(buf, buf + size); }