Skip to content

Commit de0261d

Browse files
authored
Merge pull request #789 from owenv/owenv/libtool-framework
Stop passing -framework to libtool
2 parents 7b45759 + fc4f3e8 commit de0261d

File tree

4 files changed

+2
-30
lines changed

4 files changed

+2
-30
lines changed

Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,28 +1696,7 @@ public final class LibtoolLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @u
16961696
inputPaths.append(specifier.path)
16971697
return ["@\(specifier.path.join("args.resp").str)"]
16981698

1699-
case .framework:
1700-
// A static library can build against a framework, since the library in the framework could be a static library, which is valid, and we can't tell here whether it is or not. So we leave it to libtool to do the right thing here.
1701-
// Also, we wouldn't want to emit an error here even if we could determine that it contained a dylib, since the target might be only using the framework to find headers.
1702-
1703-
// If directed to link it weakly, we emit a warning, since libtool can't perform weak linking (since it's not really linking). Then we pass it normally.
1704-
// We silently ignore other non-normal modes, since they are only set programmatically and there's nothing the user can do about them.
1705-
if specifier.mode == .weak {
1706-
delegate.warning("Product \(cbc.output.basename) cannot weak-link \(specifier.kind) \(basename)")
1707-
}
1708-
1709-
let frameworkName = Path(basename).withoutSuffix
1710-
if specifier.useSearchPaths {
1711-
return ["-framework", frameworkName]
1712-
} else {
1713-
// If we aren't using search paths, we point to the library inside the framework.
1714-
//
1715-
// FIXME: This is probably a mis-feature, I doubt it is a good idea to bypass the linker's notion of frameworkness.
1716-
let frameworkLibraryPath = specifier.path.join(frameworkName)
1717-
return [frameworkLibraryPath.str]
1718-
}
1719-
1720-
case .dynamic, .textBased:
1699+
case .dynamic, .textBased, .framework:
17211700
// A static library can't build against a dynamic library, or against a .tbd file, so we don't add any arguments here. But the inclusion of such a file in the Link Binaries build phase might be used to find implicit dependencies.
17221701
// We don't have a concrete example of this, and we used to emit an error here, but we removed it in <rdar://problem/34314195>.
17231702
return []

Tests/SWBCoreTests/CommandLineSpecTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,6 @@ import SWBMacro
15201520
"-lfoo1", "-lfoo2", Path.root.join("usr/lib/libfoo3.a").str, Path.root.join("usr/lib/libfoo4.a").str,
15211521
// dylibs are not passed
15221522
// tbd files are not passed
1523-
"-framework", "Foo1", "-framework", "Foo2", Path.root.join("tmp/Foo3.framework/Foo3").str, Path.root.join("tmp/Foo4.framework/Foo4").str,
15241523
"-o", Path.root.join("tmp/obj/normal/x86_64/output").str])
15251524
// FIXME: The input here should really be the link file list.
15261525
task.checkInputs([

Tests/SWBTaskConstructionTests/SignatureCollectionTaskConstructionTests.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ fileprivate struct SignatureCollectionTaskConstructionTests: CoreBasedTests {
136136

137137
// Check that there are warnings about trying to weak-link libraries.
138138
results.checkWarning("Product libStaticLib1.a cannot weak-link static library libStaticLib2.a (in target 'StaticLib1' from project 'aProject')")
139-
results.checkWarning("Product libStaticLib1.a cannot weak-link framework Framework.framework (in target 'StaticLib1' from project 'aProject')")
140-
results.checkWarning("Product libStaticLib2.a cannot weak-link framework Framework.framework (in target 'StaticLib2' from project 'aProject')")
141139

142140
// Check that there are no other diagnostics.
143141
results.checkNoDiagnostics()
@@ -168,8 +166,6 @@ fileprivate struct SignatureCollectionTaskConstructionTests: CoreBasedTests {
168166

169167
// Check that there are warnings about trying to weak-link libraries.
170168
results.checkWarning("Product libStaticLib1.a cannot weak-link static library libStaticLib2.a (in target 'StaticLib1' from project 'aProject')")
171-
results.checkWarning("Product libStaticLib1.a cannot weak-link framework Framework.framework (in target 'StaticLib1' from project 'aProject')")
172-
results.checkWarning("Product libStaticLib2.a cannot weak-link framework Framework.framework (in target 'StaticLib2' from project 'aProject')")
173169

174170
// Check that there are no other diagnostics.
175171
results.checkNoDiagnostics()

Tests/SWBTaskConstructionTests/TaskConstructionTests.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5038,8 +5038,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests {
50385038

50395039
// Check that the task contains a command line option to link libStaticLib2.a.
50405040
task.checkCommandLineContains(["-lStaticLib2"])
5041-
// Check that the task contains a command line option to link Framework.framework.
5042-
task.checkCommandLineContains(["-framework", "Framework"])
5041+
50435042
// Check that the task does *not* declare libAnotherStatic.a as an input, since it is located via search paths. Some projects may have a file reference whose path does not refer to a file, but which relies on finding the library via search paths anyway.
50445043
task.checkNoInputs(contain: [.pathPattern(.suffix("libAnotherStatic.a"))])
50455044
// Check that the task does *not* declare libStaticLib2.a as an input, since it is located via search paths. Some projects may have a file reference whose path does not refer to a file, but which relies on finding the library via search paths anyway.
@@ -5076,7 +5075,6 @@ fileprivate struct TaskConstructionTests: CoreBasedTests {
50765075

50775076
// Check that there are warnings about trying to weak-link libraries.
50785077
results.checkWarning("Product libStaticLib1.a cannot weak-link static library libStaticLib2.a (in target 'StaticLib1' from project 'aProject')")
5079-
results.checkWarning("Product libStaticLib1.a cannot weak-link framework Framework.framework (in target 'StaticLib1' from project 'aProject')")
50805078

50815079
// Check that there are no other diagnostics.
50825080
results.checkNoDiagnostics()

0 commit comments

Comments
 (0)