File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Sources/SwiftDriver/Driver Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -2751,7 +2751,9 @@ 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 || targetTriple. os == . wasi) {
2754
+ if !( targetTriple. isWindows ||
2755
+ targetTriple. isDarwin ||
2756
+ [ . freeBSD, . linux, . wasi] . contains ( targetTriple. os) ) {
2755
2757
diagnosticEngine. emit (
2756
2758
. error_unsupported_opt_for_target(
2757
2759
arg: " -sanitize= " ,
Original file line number Diff line number Diff line change @@ -2908,6 +2908,31 @@ final class SwiftDriverTests: XCTestCase {
2908
2908
}
2909
2909
#endif
2910
2910
2911
+ // FIXME: This test will fail when not run on FreeBSD, because the driver uses
2912
+ // the existence of the runtime support libraries to determine if
2913
+ // a sanitizer is supported. Until we allow cross-compiling with
2914
+ // sanitizers, this test is disabled outside FreeBSD.
2915
+ #if os(FreeBSD)
2916
+ do {
2917
+ var driver = try Driver (
2918
+ args: commonArgs + [
2919
+ " -target " , " x86_64-unknown-freebsd14.3 " , " -sanitize=address "
2920
+ ]
2921
+ )
2922
+ let plannedJobs = try driver. planBuild ( )
2923
+
2924
+ XCTAssertEqual ( plannedJobs. count, 4 )
2925
+
2926
+ let compileJob = plannedJobs [ 0 ]
2927
+ let compileCmd = compileJob. commandLine
2928
+ XCTAssertTrue ( compileCmd. contains ( . flag( " -sanitize=address " ) ) )
2929
+
2930
+ let linkJob = plannedJobs [ 3 ]
2931
+ let linkCmd = linkJob. commandLine
2932
+ XCTAssertTrue ( linkCmd. contains ( . flag( " -fsanitize=address " ) ) )
2933
+ }
2934
+ #endif
2935
+
2911
2936
func checkWASITarget( target: String , clangOSDir: String ) throws {
2912
2937
try withTemporaryDirectory { resourceDir in
2913
2938
var env = ProcessEnv . block
You can’t perform that action at this time.
0 commit comments