Skip to content

Commit

Permalink
[asan] Fix incorrect SEH symbol mangling on win64.
Browse files Browse the repository at this point in the history
Summary:
The ASAN unittests are failing (check-asan-dynamic) due to an incorrect symbol name:
```
LINK : error LNK2001: unresolved external symbol ___asan_seh_interceptor
```

On win64, the linker is not adding an extra underscore. This was correctly fixed in the same file for other uses.

After that patch, most of the unittests are passing, but some related to SEH needs to be fixed.
```
Failing Tests (4):
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memchr.cc
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memcpy_indirect.cc
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_seh.cc
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/seh.cc

  Expected Passes    : 339
  Passes With Retry  : 3
  Expected Failures  : 16
  Unsupported Tests  : 152
  Unexpected Failures: 4
```

Reviewers: rnk, kcc, majnemer

Subscribers: majnemer, chrisha, cfe-commits

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

llvm-svn: 282251
  • Loading branch information
bergeret committed Sep 23, 2016
1 parent fde6213 commit a768cd7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clang/lib/Driver/Tools.cpp
Expand Up @@ -10235,7 +10235,10 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
// Make sure the dynamic runtime thunk is not optimized out at link time
// to ensure proper SEH handling.
CmdArgs.push_back(Args.MakeArgString("-include:___asan_seh_interceptor"));
CmdArgs.push_back(Args.MakeArgString(
TC.getArch() == llvm::Triple::x86
? "-include:___asan_seh_interceptor"
: "-include:__asan_seh_interceptor"));
} else if (DLL) {
CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
} else {
Expand Down

0 comments on commit a768cd7

Please sign in to comment.