[PATCH] D26770: [asan] Make ASan compatible with linker dead stripping on Windows

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 15:18:51 PST 2016


rnk created this revision.
rnk added reviewers: pcc, kcc, mehdi_amini, kubabrecka.
rnk added a subscriber: llvm-commits.

This is similar to what was done for Darwin in https://reviews.llvm.org/rL264645 /
http://reviews.llvm.org/D16737, but it uses COFF COMDATs to achive the
same result instead of relying on new custom linker features.

As on MachO, this creates one metadata global per instrumented global.
The metadata global is placed in the custom .ASAN$GL section, which the
ASan runtime will iterate over during initialization. There are no other
references to the metadata, so normal linker dead stripping would
discard it. However, the metadata is put in a COMDAT group with the
instrumented global, so that it will be discarded if and only if the
instrumented global is discarded.

I didn't update the ASan ABI version check since this doesn't affect
non-Windows platforms, and the WinASan ABI isn't really stable yet.

Implementing this for ELF will require extending LLVM IR and MC a bit so
that we can use non-COMDAT section groups.


https://reviews.llvm.org/D26770

Files:
  lib/Transforms/Instrumentation/AddressSanitizer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26770.78273.patch
Type: text/x-patch
Size: 9732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161116/143bd9b7/attachment.bin>


More information about the llvm-commits mailing list