diff --git a/lib/Frontend/ParseableInterfaceSupport.cpp b/lib/Frontend/ParseableInterfaceSupport.cpp index 5d5b8895d72..58c5efa8e7c 100644 --- a/lib/Frontend/ParseableInterfaceSupport.cpp +++ b/lib/Frontend/ParseableInterfaceSupport.cpp @@ -344,10 +344,12 @@ static bool buildSwiftModuleFromSwiftInterface( } LLVM_DEBUG(llvm::dbgs() << "Serializing " << OutPath << "\n"); + FrontendOptions &FEOpts = SubInvocation.getFrontendOptions(); SerializationOptions SerializationOpts; std::string OutPathStr = OutPath; SerializationOpts.OutputPath = OutPathStr.c_str(); SerializationOpts.SerializeAllSIL = true; + SerializationOpts.ModuleLinkName = FEOpts.ModuleLinkName; SmallVector Deps; if (collectDepsForSerialization(FS, SubInstance, InPath, ModuleCachePath, Deps, Diags, OuterTracker)) { diff --git a/test/ParseableInterface/Inputs/TestModule.swift b/test/ParseableInterface/Inputs/TestModule.swift new file mode 100644 index 00000000000..4d601174a41 --- /dev/null +++ b/test/ParseableInterface/Inputs/TestModule.swift @@ -0,0 +1,3 @@ +public struct TestStruct { + public init() {} +} diff --git a/test/ParseableInterface/linking-to-module.swift b/test/ParseableInterface/linking-to-module.swift new file mode 100644 index 00000000000..ee9dd64f542 --- /dev/null +++ b/test/ParseableInterface/linking-to-module.swift @@ -0,0 +1,10 @@ +// RUN: %empty-directory(%t) + +// RUN: %target-build-swift -emit-library -module-name TestModule -module-link-name coreTestModuleKitUtilsTool %S/Inputs/TestModule.swift -emit-parseable-module-interface -o %t/libcoreTestModuleKitUtilsTool.%target-dylib-extension +// RUN: %target-swift-frontend -emit-ir -I %t -L %t -enable-parseable-module-interface %s | %FileCheck %s + +import TestModule + +_ = TestStruct() + +// CHECK: -lcoreTestModuleKitUtilsTool