From bbd6db8032990d9ea726119b194145f24f75aef3 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Tue, 13 Aug 2013 22:32:35 +0000 Subject: [PATCH] Link in the ubsan runtime when building shared objects. llvm-svn: 188325 --- clang/lib/Driver/Tools.cpp | 3 --- clang/test/Driver/sanitizer-ld.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index a6be76ea3a3f..2ae23aec8e15 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1734,9 +1734,6 @@ static void addLsanRTLinux(const ToolChain &TC, const ArgList &Args, static void addUbsanRTLinux(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs, bool IsCXX, bool HasOtherSanitizerRt) { - if (Args.hasArg(options::OPT_shared)) - return; - // Need a copy of sanitizer_common. This could come from another sanitizer // runtime; if we're not including one, include our own copy. if (!HasOtherSanitizerRt) diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c index bfc9edbfb393..691b44bba262 100644 --- a/clang/test/Driver/sanitizer-ld.c +++ b/clang/test/Driver/sanitizer-ld.c @@ -152,7 +152,7 @@ // RUN: -shared \ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHARED %s // CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}" -// CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan-i386.a" +// CHECK-UBSAN-LINUX-SHARED: libclang_rt.ubsan-i386.a" // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-unknown-linux -fsanitize=leak \