[PATCH] D29159: [clang] Add linker flag when including "asan_dynamic_runtime_thunk".

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 13:53:35 PST 2017


mpividori updated this revision to Diff 85964.
mpividori added a comment.

I fix a test for clang driver, that was failing with this modification.


https://reviews.llvm.org/D29159

Files:
  lib/Driver/Tools.cpp
  test/Driver/cl-link.c


Index: test/Driver/cl-link.c
===================================================================
--- test/Driver/cl-link.c
+++ test/Driver/cl-link.c
@@ -22,8 +22,9 @@
 // ASAN-MD: "-debug"
 // ASAN-MD: "-incremental:no"
 // ASAN-MD: "{{.*}}clang_rt.asan_dynamic-i386.lib"
-// ASAN-MD: "{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
+// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
 // ASAN-MD: "-include:___asan_seh_interceptor"
+// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
 // ASAN-MD: "{{.*}}cl-link{{.*}}.obj"
 
 // RUN: %clang_cl /LD -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -10926,6 +10926,10 @@
           TC.getArch() == llvm::Triple::x86
               ? "-include:___asan_seh_interceptor"
               : "-include:__asan_seh_interceptor"));
+      // Make sure the linker consider all object files from the dynamic runtime
+      // thunk.
+      CmdArgs.push_back(Args.MakeArgString(std::string("-wholearchive:") +
+          TC.getCompilerRT(Args, "asan_dynamic_runtime_thunk")));
     } else if (DLL) {
       CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
     } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29159.85964.patch
Type: text/x-patch
Size: 1327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170126/9e0acfe4/attachment.bin>


More information about the llvm-commits mailing list