File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -2751,7 +2751,7 @@ extension Driver {
2751
2751
}
2752
2752
2753
2753
// Check that we're one of the known supported targets for sanitizers.
2754
- if !( targetTriple. isWindows || targetTriple. isDarwin || targetTriple. os == . linux) {
2754
+ if !( targetTriple. isWindows || targetTriple. isDarwin || targetTriple. os == . linux || targetTriple . os == . wasi ) {
2755
2755
diagnosticEngine. emit (
2756
2756
. error_unsupported_opt_for_target(
2757
2757
arg: " -sanitize= " ,
Original file line number Diff line number Diff line change @@ -165,8 +165,12 @@ extension WebAssemblyToolchain {
165
165
166
166
// Delegate to Clang for sanitizers. It will figure out the correct linker
167
167
// options.
168
- guard sanitizers. isEmpty else {
169
- throw Error . sanitizersUnsupportedForTarget ( targetTriple. triple)
168
+ if linkerOutputType == . executable && !sanitizers. isEmpty {
169
+ let sanitizerNames = sanitizers
170
+ . map { $0. rawValue }
171
+ . sorted ( ) // Sort so we get a stable, testable order
172
+ . joined ( separator: " , " )
173
+ commandLine. appendFlag ( " -fsanitize= \( sanitizerNames) " )
170
174
}
171
175
172
176
if parsedOptions. hasArgument ( . profileGenerate) {
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ public final class WebAssemblyToolchain: Toolchain {
146
146
targetTriple: Triple ,
147
147
isShared: Bool
148
148
) throws -> String {
149
- throw Error . sanitizersUnsupportedForTarget ( targetTriple. triple )
149
+ return " libclang_rt. \( sanitizer . libraryName ) - \( targetTriple. archName ) .a "
150
150
}
151
151
152
152
public func platformSpecificInterpreterEnvironmentVariables( env: [ String : String ] ,
You can’t perform that action at this time.
0 commit comments