Skip to content

Commit 1d1fcb8

Browse files
authored
Merge pull request #943 from johnbute/verbosity-fix
Verbosity fix
2 parents 24cf84d + bd58e22 commit 1d1fcb8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,29 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
302302
return ["ld", "libtool"]
303303
}
304304

305+
static let outputAgnosticLinkerArguments = Set<ByteString>([
306+
"-v"
307+
])
308+
309+
func isOutputAgnosticLinkerArgument(_ argument: ByteString, prevArgument: ByteString?) -> Bool {
310+
if LdLinkerSpec.outputAgnosticLinkerArguments.contains(argument) {
311+
return true
312+
}
313+
314+
return false
315+
}
316+
317+
public override func commandLineForSignature(for task: any ExecutableTask) -> [ByteString]? {
318+
return task.commandLine.indices.compactMap { index in
319+
let arg = task.commandLine[index].asByteString
320+
let prevArg = index > task.commandLine.startIndex ? task.commandLine[index - 1].asByteString : nil
321+
if isOutputAgnosticLinkerArgument(arg, prevArgument: prevArg) {
322+
return nil
323+
}
324+
return arg
325+
}
326+
}
327+
305328
public func sparseSDKSearchPathArguments(_ cbc: CommandBuildContext) -> [String] {
306329
var specialArgs = [String]()
307330

0 commit comments

Comments
 (0)