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
This commit is contained in:
etienneb 2017-02-21 13:27:35 -08:00 коммит произвёл Commit bot
Родитель 769428e39e
Коммит fbe2ae32dc
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -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" ]
}
}
}