Skip to content

Commit 1cf7623

Browse files
authored
Merge pull request #948 from owenv/owenv/link-fix
Only drop fobjc-arc from link lines when linking with swiftc
2 parents 048cbb8 + 4e89d03 commit 1cf7623

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Sources/SWBUniversalPlatform/Specs/Clang.xcspec

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,35 @@
280280
);
281281
NO = ();
282282
};
283+
AdditionalLinkerArgs = {
284+
YES = (
285+
"$(ARC_LINKER_ARG_LINKER_DRIVER)",
286+
);
287+
NO = ();
288+
};
283289
FileTypes = (
284290
"sourcecode.c.objc",
285291
"sourcecode.cpp.objcpp",
286292
);
287293
Category = LanguageObjC;
288294
},
295+
{
296+
Name = "ARC_LINKER_ARG_LINKER_DRIVER";
297+
Type = String;
298+
DefaultValue = "$(ARC_LINKER_ARG_LINKER_DRIVER_$(LINKER_DRIVER))";
299+
},
300+
301+
{
302+
Name = "ARC_LINKER_ARG_LINKER_DRIVER_swiftc";
303+
Type = StringList;
304+
DefaultValue = "";
305+
},
306+
307+
{
308+
Name = "ARC_LINKER_ARG_LINKER_DRIVER_clang";
309+
Type = StringList;
310+
DefaultValue = "-fobjc-arc";
311+
},
289312
{
290313
Name = "CLANG_ENABLE_OBJC_WEAK";
291314
Type = Boolean;

Tests/SWBTaskConstructionTests/TaskConstructionTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests {
498498
results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList"])) { _ in }
499499
results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in
500500
task.checkRuleInfo(["Ld", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget", "normal"])
501-
task.checkCommandLine(["clang++", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-lstatic", "-ldynamic", "-framework", "Framework", "-framework", "AppCore", "-weak_framework", "AppExtensions", "-framework", "Framework-Matched-Included", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"])
501+
task.checkCommandLine(["clang++", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat", "-fobjc-arc", "-fobjc-link-runtime", "-lstatic", "-ldynamic", "-framework", "Framework", "-framework", "AppCore", "-weak_framework", "AppExtensions", "-framework", "Framework-Matched-Included", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"])
502502

503503
task.checkInputs([
504504
.path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o"),

0 commit comments

Comments
 (0)