Add Undefined Behavior sanitizer to Swift Driver (#18553)

This change allows the swift driver to link the ubsan runtime if
`-sanitize=undefined` is specified.
This is useful for sanitizing linked Objective-C code.
This commit is contained in:
Rahul Malik
2018-11-13 12:11:56 -08:00
committed by George Karpenkov
parent 6462473696
commit d3cc043e58
22 changed files with 56 additions and 1 deletions

View File

@@ -301,9 +301,13 @@ toolchains::GenericUnix::constructInvocation(const LinkJobAction &job,
if (context.OI.SelectedSanitizers & SanitizerKind::Thread)
addLinkSanitizerLibArgsForLinux(context.Args, Arguments, "tsan", *this);
if (context.OI.SelectedSanitizers & SanitizerKind::Undefined)
addLinkSanitizerLibArgsForLinux(context.Args, Arguments, "ubsan", *this);
if (context.OI.SelectedSanitizers & SanitizerKind::Fuzzer)
addLinkRuntimeLib(context.Args, Arguments,
sanitizerRuntimeLibName("fuzzer"));
}
}