diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp index 458bbaa289f4..ef84a9d7c0e8 100644 --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -633,7 +633,8 @@ void DataInCodeSection::finalizeContents() { } void DataInCodeSection::writeTo(uint8_t *buf) const { - memcpy(buf, entries.data(), getRawSize()); + if (!entries.empty()) + memcpy(buf, entries.data(), getRawSize()); } FunctionStartsSection::FunctionStartsSection()