[PATCH] D29334: [asan] Ensure we export all the interface when considering the static library.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 11:49:44 PST 2017


mpividori added a comment.

@kcc It worked before because:

- We were including part of asan's interface in `asan_win_dll_thunk.cc`.
- Object files including definition for that part of asan's interface were fortunately included by the linker because they resolve some symbols needed for the main executable.

This could change in the future, for example, suppose this case:

- The dll includes instrumentation for "some_fun", so it needs to resolve `some_fun`.
- `some_fun` is defined in `somefile.cc`.
- `somefile.cc.o` is included in libasan.lib.
- Suppose the main executable doesn't need to resolve `some_fun()`, because it was not included in its instrumentation, and suppose that the object file  `somefile.cc.o` doesn't resolve any other dependency needed by the main executable.

So, in that situation, `some_fun()` is not included in the main executable, so it is not exported, so the instrumented dll can't find it.

When considering MT, asan is implemented as a static library linked to the main executable and the instrumented dlls need access to that library. So we need to ensure that we export all the sanitizer's interface.

This is checked with the test: `interface_symbols_windows.c` introduced in https://reviews.llvm.org/D29148

Thanks.


Repository:
  rL LLVM

https://reviews.llvm.org/D29334





More information about the llvm-commits mailing list