Skip to content

Adapt QNX support to the introduction of LINKER_DRIVER #637

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/SWBCore/Settings/BuiltinMacros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2706,6 +2706,7 @@ public enum LinkerDriverChoice: String, Equatable, Hashable, EnumerationMacroTyp
public static let defaultValue: LinkerDriverChoice = .clang

case clang
case qcc
case swiftc
case auto
}
Expand Down
4 changes: 4 additions & 0 deletions Sources/SWBCore/SpecImplementations/ProductTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ public class ProductTypeSpec : Spec, SpecType, @unchecked Sendable {
args += ["-compatibility_version", compatibilityVersion]
case .swiftc:
args += ["-Xlinker", "-compatibility_version", "-Xlinker", compatibilityVersion]
case .qcc:
break
case .auto:
preconditionFailure("Expected LINKER_DRIVER to be bound to a concrete value")
}
Expand All @@ -287,6 +289,8 @@ public class ProductTypeSpec : Spec, SpecType, @unchecked Sendable {
args += ["-current_version", currentVersion]
case .swiftc:
args += ["-Xlinker", "-current_version", "-Xlinker", currentVersion]
case .qcc:
break
case .auto:
preconditionFailure("Expected LINKER_DRIVER to be bound to a concrete value")
}
Expand Down
10 changes: 9 additions & 1 deletion Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,10 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
switch cbc.scope.evaluate(BuiltinMacros.LINKER_DRIVER) {
case .clang:
return .clang
case .qcc:
return .qcc
case .swiftc:
return.swiftc
return .swiftc
case .auto:
if Self.isUsingSwift(usedTools) {
return .swiftc
Expand Down Expand Up @@ -1170,6 +1172,12 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
} else {
return Path(cbc.producer.hostOperatingSystem.imageFormat.executableName(basename: "clang"))
}
case .qcc:
if usedCXX {
return Path(cbc.producer.hostOperatingSystem.imageFormat.executableName(basename: "q++"))
} else {
return Path(cbc.producer.hostOperatingSystem.imageFormat.executableName(basename: "qcc"))
}
case .swiftc:
return Path(cbc.producer.hostOperatingSystem.imageFormat.executableName(basename: "swiftc"))
case .auto:
Expand Down
2 changes: 2 additions & 0 deletions Sources/SWBQNXPlatform/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ struct QNXSDKRegistryExtension: SDKRegistryExtension {

"ARCH_NAME_x86_64": .plString("x86_64"),
"ARCH_NAME_aarch64": .plString("aarch64le"),

"LINKER_DRIVER": "qcc",
]

return [(qnxSdk.sysroot, qnxPlatform, [
Expand Down
2 changes: 1 addition & 1 deletion Sources/SWBUniversalPlatform/Specs/Ld.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
{
Name = "LD_OPTIMIZATION_LEVEL";
Type = String;
Condition = "$(LINKER_DRIVER) == clang";
Condition = "$(LINKER_DRIVER) == clang || $(LINKER_DRIVER) == qcc";
DefaultValue = "$(GCC_OPTIMIZATION_LEVEL)";
"CommandLinePrefixFlag" = "-O";
},
Expand Down
Loading