summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-01-15 23:25:37 +0000
committerPete Cooper <peter_cooper@apple.com>2016-01-15 23:25:37 +0000
commit20de822232b927b7f4b4de9555b225a5f616b895 (patch)
treeeac3b17f539d6a0e6cd5e14ab6fb9c8b2576e876 /lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
parent230af4047d4c3f281dc0469d2144e10b9c5e8c0f (diff)
downloadbcm5719-llvm-20de822232b927b7f4b4de9555b225a5f616b895.tar.gz
bcm5719-llvm-20de822232b927b7f4b4de9555b225a5f616b895.zip
Check that the objc image info version is exactly 0
llvm-svn: 257953
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp8
1 files changed, 8 insertions, 0 deletions
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();
}
OpenPOWER on IntegriCloud