[cfe-commits] r172856 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/ubsan-ld.c
Jean-Daniel Dupas
devlists at shadowlab.org
Sat Jan 19 16:59:09 PST 2013
Should it be done for darwin too ? (see Toolchains.cpp:321)
Le 18 janv. 2013 à 23:09, Richard Smith <richard-llvm at metafoo.co.uk> a écrit :
>
> Author: rsmith
> Date: Fri Jan 18 16:09:26 2013
> New Revision: 172856
>
> URL: http://llvm.org/viewvc/llvm-project?rev=172856&view=rev
> Log:
> Include ubsan runtime even when building a shared library. We don't require the executable to be linked with UBSan.
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/test/Driver/ubsan-ld.c
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=172856&r1=172855&r2=172856&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri Jan 18 16:09:26 2013
> @@ -1587,17 +1587,15 @@
> /// (Linux).
> static void addUbsanRTLinux(const ToolChain &TC, const ArgList &Args,
> ArgStringList &CmdArgs) {
> - if (!Args.hasArg(options::OPT_shared)) {
> - // LibUbsan is "libclang_rt.ubsan-<ArchName>.a" in the Linux library
> - // resource directory.
> - SmallString<128> LibUbsan(TC.getDriver().ResourceDir);
> - llvm::sys::path::append(LibUbsan, "lib", "linux",
> - (Twine("libclang_rt.ubsan-") +
> - TC.getArchName() + ".a"));
> - CmdArgs.push_back(Args.MakeArgString(LibUbsan));
> - CmdArgs.push_back("-lpthread");
> - CmdArgs.push_back("-export-dynamic");
> - }
> + // LibUbsan is "libclang_rt.ubsan-<ArchName>.a" in the Linux library
> + // resource directory.
> + SmallString<128> LibUbsan(TC.getDriver().ResourceDir);
> + llvm::sys::path::append(LibUbsan, "lib", "linux",
> + (Twine("libclang_rt.ubsan-") +
> + TC.getArchName() + ".a"));
> + CmdArgs.push_back(Args.MakeArgString(LibUbsan));
> + CmdArgs.push_back("-lpthread");
> + CmdArgs.push_back("-export-dynamic");
> }
>
> static bool shouldUseFramePointer(const ArgList &Args,
>
> Modified: cfe/trunk/test/Driver/ubsan-ld.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ubsan-ld.c?rev=172856&r1=172855&r2=172856&view=diff
> ==============================================================================
> --- cfe/trunk/test/Driver/ubsan-ld.c (original)
> +++ cfe/trunk/test/Driver/ubsan-ld.c Fri Jan 18 16:09:26 2013
> @@ -9,6 +9,16 @@
> // CHECK-LINUX: libclang_rt.ubsan-i386.a"
> // CHECK-LINUX: "-lpthread"
>
> +// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
> +// RUN: -target i386-unknown-linux \
> +// RUN: --sysroot=%S/Inputs/basic_linux_tree \
> +// RUN: -shared \
> +// RUN: | FileCheck --check-prefix=CHECK-LINUX-SHARED %s
> +// CHECK-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}"
> +// CHECK-LINUX-SHARED-NOT: "-lc"
> +// CHECK-LINUX-SHARED: libclang_rt.ubsan-i386.a"
> +// CHECK-LINUX-SHARED: "-lpthread"
> +
> // RUN: %clang -fsanitize=bounds %s -### -o %t.o 2>&1 \
> // RUN: -target i386-unknown-linux \
> // RUN: --sysroot=%S/Inputs/basic_linux_tree \
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-- Jean-Daniel
More information about the cfe-commits
mailing list