[compiler-rt] Fix interception of multiple defined symbols.
authorEtienne Bergeron <etienneb@google.com>
Wed, 28 Sep 2016 18:04:07 +0000 (18:04 +0000)
committerEtienne Bergeron <etienneb@google.com>
Wed, 28 Sep 2016 18:04:07 +0000 (18:04 +0000)
commit42cdfbcf3e92466754c175cb0e1e237e9f66749e
treeb2feac7251ed1d208bb04274420a29b0ce1ded74
parentfea5c7a051299aa4a128851d5ea8968a2e3d9d14
[compiler-rt] Fix interception of multiple defined symbols.

Summary:
The MSVC compiler is generating multiple instance of the exception handler
when compiling on win64 with /MD.

see: https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

Two tests were failing when running:
```
ninja check-asan-dynamic.
```

The tests were failing because only the first occurence of the function was patched.
The function `__C_specific_handler` is defined in `ntdll` and `vcruntime140`.

After this patch, there is still two remaining tests failing.
```
********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 87.81s
********************
Failing Tests (2):
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memchr.cc
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memcpy_indirect.cc

  Expected Passes    : 342
  Passes With Retry  : 2
  Expected Failures  : 16
  Unsupported Tests  : 152
  Unexpected Failures: 2
```

Reviewers: rnk, vitalybuka

Subscribers: vitalybuka, llvm-commits, chrisha, dberris

Differential Revision: https://reviews.llvm.org/D24983

llvm-svn: 282614
compiler-rt/lib/interception/interception_win.cc