[asan] Create a .ASAN$G(A-Z) section for global registration
authorReid Kleckner <rnk@google.com>
Thu, 17 Nov 2016 19:02:53 +0000 (19:02 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 17 Nov 2016 19:02:53 +0000 (19:02 +0000)
commit39950b0f925b12349350f2f895d8ce34223da10a
tree35e389275c35a94883190e5da6fea99185f63be8
parenta07c531ef9fd7d621097ac1d797a020af06659c4
[asan] Create a .ASAN$G(A-Z) section for global registration

Summary:
The expectation is that new instrumented code will add global variable
metadata to the .ASAN$GL section, and we will use this new code to
iterate over it.

This technique seems to break when using incremental linking, which
seems to align every global to a 256 byte boundary. Presumably this is
so that it can incrementally cope with global changing size. Clang
already passes -incremental:no as a linker flag when you invoke it to do
the link step.

The two tests added for this feature will fail until the LLVM
instrumentation change in D26770 lands, so they are marked XFAIL for
now.

Reviewers: pcc, kcc, mehdi_amini, kubabrecka

Subscribers: llvm-commits, mgorny

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

llvm-svn: 287246
compiler-rt/lib/asan/CMakeLists.txt
compiler-rt/lib/asan/asan_globals.cc
compiler-rt/lib/asan/asan_globals_win.cc [new file with mode: 0644]
compiler-rt/lib/asan/asan_globals_win.h [new file with mode: 0644]
compiler-rt/lib/asan/asan_win.cc
compiler-rt/lib/asan/asan_win_dll_thunk.cc
compiler-rt/lib/asan/asan_win_dynamic_runtime_thunk.cc
compiler-rt/lib/asan/tests/CMakeLists.txt
compiler-rt/test/asan/TestCases/Windows/dll_global_dead_strip.c [new file with mode: 0644]
compiler-rt/test/asan/TestCases/Windows/global_dead_strip.c [new file with mode: 0644]