File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,14 @@ extension GenericUnixToolchain {
152
152
)
153
153
commandLine. appendPath ( swiftrtPath)
154
154
155
+ // If we are linking statically, we need to add all
156
+ // dependencies to a library search group to resolve
157
+ // potential circular dependencies
158
+ if staticStdlib || staticExecutable {
159
+ commandLine. appendFlag ( . Xlinker)
160
+ commandLine. appendFlag ( " --start-group " )
161
+ }
162
+
155
163
let inputFiles : [ Job . ArgTemplate ] = inputs. compactMap { input in
156
164
// Autolink inputs are handled specially
157
165
if input. type == . autolink {
@@ -166,6 +174,11 @@ extension GenericUnixToolchain {
166
174
}
167
175
commandLine. append ( contentsOf: inputFiles)
168
176
177
+ if staticStdlib || staticExecutable {
178
+ commandLine. appendFlag ( . Xlinker)
179
+ commandLine. appendFlag ( " --end-group " )
180
+ }
181
+
169
182
let fSystemArgs = parsedOptions. arguments ( for: . F, . Fsystem)
170
183
for opt in fSystemArgs {
171
184
if opt. option == . Fsystem {
You can’t perform that action at this time.
0 commit comments