Open Lukasa opened 4 years ago
@swift-ci create
Interesting that this ever worked. You’re effectively on your own when you use -X* escape hatch so this can’t be considered a bug. I’d instead turn this bug into adding real support for libFuzzer in SwiftPM (or maybe we already have one).
I was able to work around this by using -v
and then stripping out all the -Xlinker
flags passed at the last build step to clang
. Very inconvenient though. How are folks fuzzing swift these days?
Environment
Swift 5.2.4, Ubuntu 20.04.Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 1 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 1628e01c9e53e190c7b97a3890151108Issue Description:
Somewhere in the last few releases of Swift, SwiftPM can no longer build the kind of executable that Swift's libfuzzer integration needs.
Previously to build a fuzzer with SwiftPM one would create a Package.swift that defined an executable product and target for the fuzzer. This executable target would not contain a
main.swift
file, as libFuzzer wants to provide its own main symbol. Instead, it would contain a different file that contained the symbolLLVMFuzzOneInput
.To build this with SwiftPM, you'd pass
-Xswiftc -sanitize=fuzzer -Xswiftc -parse-as-library
. SwiftPM would trust you, try to build the executable, and find that the linker was happy due to libfuzzer providing the main symbol.This no longer works: SwiftPM aborts early, by spotting that there is no
main.swift
file in the executable target. We should address this to re-enable libfuzzer support in SwiftPM.