Skip to content

Commit 25ffd25

Browse files
Merge pull request #31237 from varungandhi-apple/vg-5.3-remove-arm64e-fallback
[5.3] Remove fallback for arm64e -> arm64.
2 parents a032507 + 8d66b72 commit 25ffd25

File tree

6 files changed

+34
-20
lines changed

6 files changed

+34
-20
lines changed

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,10 @@ void forEachTargetModuleBasename(const ASTContext &Ctx,
4949
// names checked in "#if arch(...)". Fall back to that name in the one case
5050
// where it's different from what Swift 4.2 supported:
5151
// - 32-bit ARM platforms (formerly "arm")
52-
// - arm64e (formerly shared with "arm64")
5352
// We should be able to drop this once there's an Xcode that supports the
5453
// new names.
55-
if (Ctx.LangOpts.Target.getArch() == llvm::Triple::ArchType::arm)
54+
if (Ctx.LangOpts.Target.getArch() == llvm::Triple::ArchType::arm) {
5655
body("arm");
57-
else if (Ctx.LangOpts.Target.getSubArch() ==
58-
llvm::Triple::SubArchType::AArch64SubArch_E) {
59-
body("arm64");
6056
}
6157
}
6258

@@ -409,16 +405,20 @@ bool SerializedModuleLoader::maybeDiagnoseTargetMismatch(
409405
return false;
410406
StringRef filePath = directoryIterator->path();
411407
StringRef extension = llvm::sys::path::extension(filePath);
412-
if (file_types::lookupTypeForExtension(extension) ==
413-
file_types::TY_SwiftModuleFile) {
408+
auto fileType = file_types::lookupTypeForExtension(extension);
409+
// We also check for interfaces here, because the SerializedModuleLoader
410+
// is invoked after the ModuleInterfaceLoader; if the ModuleInterfaceLoader
411+
// handled interfaces separately, we could get duplicate diagnostics.
412+
if (fileType == file_types::TY_SwiftModuleFile
413+
|| fileType == file_types::TY_SwiftModuleInterfaceFile) {
414414
if (!foundArchs.empty())
415415
foundArchs += ", ";
416416
foundArchs += llvm::sys::path::stem(filePath).str();
417417
}
418418
}
419419

420420
if (foundArchs.empty()) {
421-
// Maybe this swiftmodule directory only contains swiftinterfaces, or
421+
// It is strange that there were no swiftmodules or swiftinterfaces here;
422422
// maybe something else is going on. Regardless, we shouldn't emit a
423423
// possibly incorrect diagnostic.
424424
return false;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// swift-interface-format-version: 1.0
2+
// swift-compiler-version: Apple Swift version 5.2
3+
// swift-module-flags: -target arm64-apple-ios13.0 -enable-library-evolution -swift-version 5 -module-name DummyFramework
4+
import Swift
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// swift-interface-format-version: 1.0
2+
// swift-compiler-version: Apple Swift version 5.2
3+
// swift-module-flags: -target arm64-apple-ios13.0 -enable-library-evolution -swift-version 5 -module-name DummyFramework
4+
import Swift

test/ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
1515
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
1616
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
17-
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
17+
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH-2 -DARCH=%module-target-triple -DTARGET_CPU=%target-cpu %s
1818
// (default)
1919
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
2020

@@ -82,19 +82,19 @@
8282

8383
// 8. Only the interface is present but for the wrong architecture.
8484
// (Diagnostics for the module only are tested elsewhere.)
85-
// FIXME: We should improve this to not just say NO-SUCH-MODULE.
8685
// RUN: rm %t/Lib.swiftmodule/garbage.swiftmodule
87-
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
88-
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
86+
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%module-target-triple %s
87+
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%module-target-triple %s
8988
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
90-
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
89+
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%module-target-triple %s
9190
// (default)
92-
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
91+
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%module-target-triple %s
9392

9493
import Lib
9594
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
9695
// BAD-MODULE: [[@LINE-2]]:8: error: malformed compiled module: {{.*}}Lib.swiftmodule
9796
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for target '[[ARCH]]'; found: garbage
97+
// WRONG-ARCH-2: [[@LINE-4]]:8: error: could not find module 'Lib' for target '[[ARCH]]'; found: [[TARGET_CPU]]
9898

9999
struct X {}
100100
let _: X = Lib.testValue

test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
1515
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
1616
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
17-
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
17+
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH-2 -DARCH=%module-target-triple -DTARGET_CPU=%target-cpu %s
1818
// (default)
1919
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
2020

@@ -83,19 +83,19 @@
8383

8484
// 8. Only the interface is present but for the wrong architecture.
8585
// (Diagnostics for the module only are tested elsewhere.)
86-
// FIXME: We should improve this to not just say NO-SUCH-MODULE.
8786
// RUN: rm %t/Lib.framework/Modules/Lib.swiftmodule/garbage.swiftmodule
88-
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
89-
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
87+
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%module-target-triple %s
88+
// RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%module-target-triple %s
9089
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
91-
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
90+
// RUN: env SWIFT_FORCE_MODULE_LOADING=only-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%module-target-triple %s
9291
// (default)
93-
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
92+
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%module-target-triple %s
9493

9594
import Lib
9695
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
9796
// BAD-MODULE: [[@LINE-2]]:8: error: malformed compiled module: {{.*}}Lib.swiftmodule
9897
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for target '[[ARCH]]'; found: garbage
98+
// WRONG-ARCH-2: [[@LINE-4]]:8: error: could not find module 'Lib' for target '[[ARCH]]'; found: [[TARGET_CPU]]
9999

100100
struct X {}
101101
let _: X = Lib.testValue
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: not %target-typecheck-verify-swift -target arm64e-apple-ios13.0 -F %S/Inputs 2>&1 | %FileCheck %s
2+
3+
// REQUIRES: OS=ios
4+
5+
import DummyFramework
6+
// CHECK: could not find module 'DummyFramework' for target 'arm64e-apple-ios'; found: arm64-apple-ios, arm64

0 commit comments

Comments
 (0)