[PATCH] D24841: [asan] Fix incorrect SEH symbol mangling on win64.

Etienne Bergeron via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 22 13:03:33 PDT 2016


etienneb created this revision.
etienneb added reviewers: rnk, kcc.
etienneb added subscribers: cfe-commits, chrisha.

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
```

https://reviews.llvm.org/D24841

Files:
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -10235,7 +10235,10 @@
         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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24841.72205.patch
Type: text/x-patch
Size: 750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160922/12dd5629/attachment-0001.bin>


More information about the cfe-commits mailing list