From fbe2ae32dcaf54fa5f1f873929353623e16bec9f Mon Sep 17 00:00:00 2001 From: etienneb Date: Tue, 21 Feb 2017 13:27:35 -0800 Subject: [PATCH] Fix removal of unreferenced ASAN API functions When a DLL is instrumented with ASAN, there is some thunks introduced that dynamically resolved the function through the imports table and redirect the call from the DLL to the main executable. Unfortunately, unreferenced functions recently got removed by the linker. Without this fix this function is not part of the final executable: __asan_locate_address % dumpbin D:\src\chromium\src\out\ninja64\initialexe\chrome.exe /exports | grep asan_l This is making chrome to crash on startup when loading chrome_elf.dll. ASAN is failing to hook on a function and call abort, which is also failing because ASAN is still in the "tls-initialisation" phase. R=ochang@chromium.org, rnk@chromium.org, thakis@chromium.org, chrisha@chromium.org BUG= Review-Url: https://codereview.chromium.org/2710573003 Cr-Original-Commit-Position: refs/heads/master@{#451836} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 803397e04777bc734a9c028813351c2e5079faf1 --- config/sanitizers/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/sanitizers/BUILD.gn b/config/sanitizers/BUILD.gn index 5b072ce59..24055aa28 100644 --- a/config/sanitizers/BUILD.gn +++ b/config/sanitizers/BUILD.gn @@ -344,9 +344,11 @@ config("link_executable") { # Windows 64-bit. TODO(etienneb): Remove the assert when this is ready. assert(false, "win/asan does not work in 64-bit yet") libs = [ "clang_rt.asan-x86_64.lib" ] + ldflags = [ "-wholearchive:clang_rt.asan-x86_64.lib" ] } else { assert(target_cpu == "x86", "WinASan unsupported architecture") libs = [ "clang_rt.asan-i386.lib" ] + ldflags = [ "-wholearchive:clang_rt.asan-i386.lib" ] } } }