@@ -2754,12 +2754,17 @@ extension Driver {
27542754 // Support is determined by existence of the sanitizer library.
27552755 // FIXME: Should we do this? This prevents cross-compiling with sanitizers
27562756 // enabled.
2757- var sanitizerSupported = try toolchain. runtimeLibraryExists (
2758- for: stableAbi ? . address_stable_abi : sanitizer,
2759- targetInfo: targetInfo,
2760- parsedOptions: & parsedOptions,
2761- isShared: sanitizer != . fuzzer && !stableAbi
2762- )
2757+ var sanitizerSupported = true
2758+
2759+ // memtag-stack sanitizer doesn't have a runtime library
2760+ if sanitizer. hasRuntimeLibrary {
2761+ sanitizerSupported = try toolchain. runtimeLibraryExists (
2762+ for: stableAbi ? . address_stable_abi : sanitizer,
2763+ targetInfo: targetInfo,
2764+ parsedOptions: & parsedOptions,
2765+ isShared: sanitizer != . fuzzer && !stableAbi
2766+ )
2767+ }
27632768
27642769 if sanitizer == . thread {
27652770 // TSAN is unavailable on Windows
@@ -2813,6 +2818,16 @@ extension Driver {
28132818 )
28142819 }
28152820
2821+ // Address and memtag-stack sanitizers can not be enabled concurrently.
2822+ if set. contains ( . memtag_stack) && set. contains ( . address) {
2823+ diagnosticEngine. emit (
2824+ . error_argument_not_allowed_with(
2825+ arg: " -sanitize=memtag-stack " ,
2826+ other: " -sanitize=address "
2827+ )
2828+ )
2829+ }
2830+
28162831 // Scudo can only be run with ubsan.
28172832 if set. contains ( . scudo) {
28182833 let allowedSanitizers : Set < Sanitizer > = [ . scudo, . undefinedBehavior]
0 commit comments