diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp @@ -879,11 +879,11 @@ llvm::dwarf::DwarfFormat Format = llvm::dwarf::DwarfFormat::DWARF32; auto infoData = dataExtractorFromSection(normalizedFile, info); uint32_t length = infoData.getU32(&offset); - if (length == 0xffffffff) { + if (length == llvm::dwarf::DW_LENGTH_DWARF64) { Format = llvm::dwarf::DwarfFormat::DWARF64; infoData.getU64(&offset); } - else if (length > 0xffffff00) + else if (length >= llvm::dwarf::DW_LENGTH_lo_reserved) return llvm::make_error("Malformed DWARF in " + path); uint16_t version = infoData.getU16(&offset);