Skip to content

Commit f70c3e9

Browse files
committed
Adapt QNX support to the introduction of LINKER_DRIVER
1 parent 163cc7e commit f70c3e9

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

Sources/SWBCore/Settings/BuiltinMacros.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,6 +2706,7 @@ public enum LinkerDriverChoice: String, Equatable, Hashable, EnumerationMacroTyp
27062706
public static let defaultValue: LinkerDriverChoice = .clang
27072707

27082708
case clang
2709+
case qcc
27092710
case swiftc
27102711
case auto
27112712
}

Sources/SWBCore/SpecImplementations/ProductTypes.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ public class ProductTypeSpec : Spec, SpecType, @unchecked Sendable {
275275
args += ["-compatibility_version", compatibilityVersion]
276276
case .swiftc:
277277
args += ["-Xlinker", "-compatibility_version", "-Xlinker", compatibilityVersion]
278+
case .qcc:
279+
break
278280
case .auto:
279281
preconditionFailure("Expected LINKER_DRIVER to be bound to a concrete value")
280282
}
@@ -287,6 +289,8 @@ public class ProductTypeSpec : Spec, SpecType, @unchecked Sendable {
287289
args += ["-current_version", currentVersion]
288290
case .swiftc:
289291
args += ["-Xlinker", "-current_version", "-Xlinker", currentVersion]
292+
case .qcc:
293+
break
290294
case .auto:
291295
preconditionFailure("Expected LINKER_DRIVER to be bound to a concrete value")
292296
}

Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,10 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
298298
switch cbc.scope.evaluate(BuiltinMacros.LINKER_DRIVER) {
299299
case .clang:
300300
return .clang
301+
case .qcc:
302+
return .qcc
301303
case .swiftc:
302-
return.swiftc
304+
return .swiftc
303305
case .auto:
304306
if Self.isUsingSwift(usedTools) {
305307
return .swiftc
@@ -1166,6 +1168,12 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
11661168
} else {
11671169
return Path(cbc.producer.hostOperatingSystem.imageFormat.executableName(basename: "clang"))
11681170
}
1171+
case .qcc:
1172+
if usedCXX {
1173+
return Path(cbc.producer.hostOperatingSystem.imageFormat.executableName(basename: "q++"))
1174+
} else {
1175+
return Path(cbc.producer.hostOperatingSystem.imageFormat.executableName(basename: "qcc"))
1176+
}
11691177
case .swiftc:
11701178
return Path(cbc.producer.hostOperatingSystem.imageFormat.executableName(basename: "swiftc"))
11711179
case .auto:

Sources/SWBQNXPlatform/Plugin.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ struct QNXSDKRegistryExtension: SDKRegistryExtension {
101101

102102
"ARCH_NAME_x86_64": .plString("x86_64"),
103103
"ARCH_NAME_aarch64": .plString("aarch64le"),
104+
105+
"LINKER_DRIVER": "qcc",
104106
]
105107

106108
return [(qnxSdk.sysroot, qnxPlatform, [

Sources/SWBUniversalPlatform/Specs/Ld.xcspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
{
176176
Name = "LD_OPTIMIZATION_LEVEL";
177177
Type = String;
178-
Condition = "$(LINKER_DRIVER) == clang";
178+
Condition = "$(LINKER_DRIVER) == clang || $(LINKER_DRIVER) == qcc";
179179
DefaultValue = "$(GCC_OPTIMIZATION_LEVEL)";
180180
"CommandLinePrefixFlag" = "-O";
181181
},

0 commit comments

Comments
 (0)