diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-11-16 12:53:14 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-11-16 12:53:14 +0000 |
commit | cc42980335a44643ce8e79c7092446581ef457c8 (patch) | |
tree | 5785603f54180043d6a387b05584ce1389866c2c /clang/lib/Driver/Tools.cpp | |
parent | 77d35747be66d16de9c3a33e7f060ce3107f7a90 (diff) | |
download | bcm5719-llvm-cc42980335a44643ce8e79c7092446581ef457c8.tar.gz bcm5719-llvm-cc42980335a44643ce8e79c7092446581ef457c8.zip |
UBSan: enable proper linking with UBsan runtime on Darwin. Turn on building ubsan on OS X in 'make' build system. Patch by Jean-Daniel Dupas.
llvm-svn: 168168
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 4dea717f985..8763f7aa77a 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -4710,10 +4710,11 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA, Args.AddAllArgs(CmdArgs, options::OPT_L); SanitizerArgs Sanitize(getToolChain().getDriver(), Args); - // If we're building a dynamic lib with -fsanitize=address, unresolved - // symbols may appear. Mark all of them as dynamic_lookup. - // Linking executables is handled in lib/Driver/ToolChains.cpp. - if (Sanitize.needsAsanRt()) { + // If we're building a dynamic lib with -fsanitize=address, or + // -fsanitize=undefined, unresolved symbols may appear. Mark all + // of them as dynamic_lookup. Linking executables is handled in + // lib/Driver/ToolChains.cpp. + if (Sanitize.needsAsanRt() || Sanitize.needsUbsanRt()) { if (Args.hasArg(options::OPT_dynamiclib) || Args.hasArg(options::OPT_bundle)) { CmdArgs.push_back("-undefined"); |