- switch (architecture) {
- case CPU_TYPE_I386:
- return ::lto_module_is_object_file_in_memory_for_target(fileContent, fileLength, "i386-");
- case CPU_TYPE_X86_64:
- return ::lto_module_is_object_file_in_memory_for_target(fileContent, fileLength, "x86_64-");
- case CPU_TYPE_ARM:
- for (const ARMSubType* t=ARMSubTypes; t->subTypeName != NULL; ++t) {
- if ( subarch == t->subType )
- return ::lto_module_is_object_file_in_memory_for_target(fileContent, fileLength, t->llvmTriplePrefix);
+ for (const ArchInfo* t=archInfoArray; t->archName != NULL; ++t) {
+ if ( (architecture == t->cpuType) && (!(t->isSubType) || (subarch == t->cpuSubType)) ) {
+ bool result = ::lto_module_is_object_file_in_memory_for_target(fileContent, fileLength, t->llvmTriplePrefix);
+ if ( !result ) {
+ // <rdar://problem/8434487> LTO only supports thumbv7 not armv7
+ if ( t->llvmTriplePrefixAlt[0] != '\0' ) {
+ result = ::lto_module_is_object_file_in_memory_for_target(fileContent, fileLength, t->llvmTriplePrefixAlt);
+ }