summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-01-19 18:46:40 +0000
committerPete Cooper <peter_cooper@apple.com>2016-01-19 18:46:40 +0000
commitfeaa967ee813be3fa34ebc2b7a4751f2ec821df5 (patch)
tree7733266fc2ad3af0bce659664619424f33233362 /lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
parent1a196f7dafb324ee9cd1d8e77aef500910053fea (diff)
downloadbcm5719-llvm-feaa967ee813be3fa34ebc2b7a4751f2ec821df5.tar.gz
bcm5719-llvm-feaa967ee813be3fa34ebc2b7a4751f2ec821df5.zip
Cache the objc image info constraints in file.
Image info flags describe the objc constraint which is GC/retain/release/etc. These need to be parsed and stored in the file so that we can do error checking. That will come in a later commit. llvm-svn: 258160
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index 342cce4cbcf..44e22ab6491 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -892,11 +892,6 @@ std::error_code parseObjCImageInfo(const NormalizedFile &normalizedFile,
// uint32_t version; // initially 0
// uint32_t flags;
// };
- enum {
- OBJC_IMAGE_SUPPORTS_GC=2,
- OBJC_IMAGE_GC_ONLY=4,
- OBJC_IMAGE_IS_SIMULATED=32,
- };
ArrayRef<uint8_t> content = imageInfoSection->content;
if (content.size() != 8)
@@ -914,12 +909,18 @@ std::error_code parseObjCImageInfo(const NormalizedFile &normalizedFile,
" should have version=0");
uint32_t flags = read32(content.data() + 4, isBig);
- if (flags & (OBJC_IMAGE_SUPPORTS_GC|OBJC_IMAGE_GC_ONLY))
+ if (flags & (MachOLinkingContext::objc_supports_gc |
+ MachOLinkingContext::objc_gc_only))
return make_dynamic_error_code(imageInfoSection->segmentName + "/" +
imageInfoSection->sectionName +
" in file " + file.path() +
" uses GC. This is not supported");
+ if (flags & MachOLinkingContext::objc_retainReleaseForSimulator)
+ file.setObjcConstraint(MachOLinkingContext::objc_retainReleaseForSimulator);
+ else
+ file.setObjcConstraint(MachOLinkingContext::objc_retainRelease);
+
file.setSwiftVersion((flags >> 8) & 0xFF);
return std::error_code();
OpenPOWER on IntegriCloud