-
Notifications
You must be signed in to change notification settings - Fork 91
Wire up support for module wrapping on non-Darwin platforms #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2127,6 +2127,11 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi | |
return (inputs, outputs) | ||
}() | ||
|
||
if cbc.scope.evaluate(BuiltinMacros.PLATFORM_REQUIRES_SWIFT_MODULEWRAP) && cbc.scope.evaluate(BuiltinMacros.GCC_GENERATE_DEBUGGING_SYMBOLS) { | ||
let moduleWrapOutput = Path(moduleFilePath.withoutSuffix + ".o") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Windows really should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I filed #149 to track this because it needs to be done in a few other places at the same time to avoid a regression There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @compnerd I think it's more like "MSVC ABI should use .obj and gcc/mingw ABI should use .o", right? |
||
moduleOutputPaths.append(moduleWrapOutput) | ||
} | ||
|
||
// Add const metadata outputs to extra compilation outputs | ||
if await supportConstSupplementaryMetadata(cbc, delegate, compilationMode: compilationMode) { | ||
// If using whole module optimization then we use the -master.swiftconstvalues file from the sole compilation task. | ||
|
@@ -2963,7 +2968,7 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi | |
// be a source-less target which just contains object files in it's framework phase. | ||
let currentPlatformFilter = PlatformFilter(scope) | ||
let containsSources = (producer.configuredTarget?.target as? StandardTarget)?.sourcesBuildPhase?.buildFiles.filter { currentPlatformFilter.matches($0.platformFilters) }.isEmpty == false | ||
if containsSources && inputFileTypes.contains(where: { $0.conformsTo(identifier: "sourcecode.swift") }) && scope.evaluate(BuiltinMacros.GCC_GENERATE_DEBUGGING_SYMBOLS) { | ||
if containsSources && inputFileTypes.contains(where: { $0.conformsTo(identifier: "sourcecode.swift") }) && scope.evaluate(BuiltinMacros.GCC_GENERATE_DEBUGGING_SYMBOLS) && !scope.evaluate(BuiltinMacros.PLATFORM_REQUIRES_SWIFT_MODULEWRAP) { | ||
let moduleName = scope.evaluate(BuiltinMacros.SWIFT_MODULE_NAME) | ||
let moduleFileDir = scope.evaluate(BuiltinMacros.PER_ARCH_MODULE_FILE_DIR) | ||
let moduleFilePath = moduleFileDir.join(moduleName + ".swiftmodule") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,6 +200,15 @@ extension ImageFormat { | |
return false | ||
} | ||
} | ||
|
||
public var requiresSwiftModulewrap: Bool { | ||
switch self { | ||
case .macho: | ||
return false | ||
default: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can we prefer to list the cases explicitly? I like to stay away from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is really an is-not-macho check, I don't expect we will ever move away from module wrap for any future object formats |
||
return true | ||
} | ||
} | ||
} | ||
|
||
extension FixedWidthInteger { | ||
|
Uh oh!
There was an error while loading. Please reload this page.