[Serialization] Use full target architectures for swiftmodule files (#21053)

Previously these used the same "major architecture" names that the
`#if os(...)` query accepts, but that can be a problem when building
for, say, both armv7 and armv7s, even if the content is "the same".

For a transition period where external build tools are involved, the
compiler will look for "arm.swiftmodule" if it fails to find
"armv7.swiftmodule" or any other 32-bit ARM architecture. No other
Apple platform architectures are affected, and AFAIK no one's using
the architecture-based layout on Linux or any other platforms.

rdar://problem/45174692
This commit is contained in:
Jordan Rose
2018-12-06 13:31:02 -08:00
committed by GitHub
parent 9596624981
commit 06f3c11377
4 changed files with 87 additions and 33 deletions

View File

@@ -0,0 +1,18 @@
// Test the fallback for 32-bit ARM platforms.
// RUN: %empty-directory(%t)
// RUN: mkdir -p %t/empty.framework/Modules/empty.swiftmodule
// RUN: %target-swift-frontend -emit-module -o %t/empty.framework/Modules/empty.swiftmodule/arm.swiftmodule %S/../Inputs/empty.swift -module-name empty
// RUN: %target-swift-frontend -typecheck %s -F %t
// RUN: mv %t/empty.framework/Modules/empty.swiftmodule/arm.swiftmodule %t/empty.framework/Modules/empty.swiftmodule/%target-swiftmodule-name
// RUN: touch %t/empty.framework/Modules/empty.swiftmodule/arm.swiftmodule
// RUN: %target-swift-frontend -typecheck %s -F %t
// RUN: rm %t/empty.framework/Modules/empty.swiftmodule/%target-swiftmodule-name
// RUN: not %target-swift-frontend -typecheck %s -F %t 2>&1 | %FileCheck %s
// REQUIRES: CPU=armv7 || CPU=armv7k || CPU=armv7s
import empty
// CHECK: :[[@LINE-1]]:8: error: malformed module file: {{.*}}arm.swiftmodule