From 20de822232b927b7f4b4de9555b225a5f616b895 Mon Sep 17 00:00:00 2001 From: Pete Cooper Date: Fri, 15 Jan 2016 23:25:37 +0000 Subject: Check that the objc image info version is exactly 0 llvm-svn: 257953 --- lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp') diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp index 2cebe539ad6..770b58b2270 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp @@ -903,6 +903,14 @@ std::error_code parseObjCImageInfo(const NormalizedFile &normalizedFile, " in file " + file.path() + " should be 8 bytes in size"); + const bool isBig = MachOLinkingContext::isBigEndian(normalizedFile.arch); + uint32_t version = read32(content.data(), isBig); + if (version) + return make_dynamic_error_code(imageInfoSection->segmentName + "/" + + imageInfoSection->sectionName + + " in file " + file.path() + + " should have version=0"); + return std::error_code(); } -- cgit v1.2.3