[PATCH] [RFC] Print exact source locations of global variables in ASan error reports.

Alexey Samsonov vonosmas at gmail.com
Wed Jun 18 19:14:18 PDT 2014


Hi kcc, eugenis,

This changes introduces llvm.asan.globals metadata, which can be
used by the frontend to provide additional information about the LLVM
global variables, namely:
1) source location (file/line/column) of corresponding globals in the user code.
These locations will be available at runtime, and will be printed in the
error report if needed, even if the binary is built without debug info.
2) whether global is dynamically initialized. This replaces
llvm.asan.dynamically_initialized_globals metadata used to detect init-order bugs.
3) whether the global is blacklisted. This is a first step to move all blacklist
functionality to the frontend.

Note: This is an ABI-breaking change. All users of ASan runtime library will have
to emit new layout of __asan_global structure (now it has one more field).

If you're OK with this change, I will commit it with extra ASan output tests,
checking that we're actually reporting source locations for global variables,
function-static variables and simple string literals.

http://reviews.llvm.org/D4203

Files:
  lib/Transforms/Instrumentation/AddressSanitizer.cpp
  projects/compiler-rt/lib/asan/asan_interface_internal.h
  projects/compiler-rt/lib/asan/asan_report.cc
  test/Instrumentation/AddressSanitizer/instrument_global.ll
  test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll
  tools/clang/lib/CodeGen/CGDecl.cpp
  tools/clang/lib/CodeGen/CodeGenModule.cpp
  tools/clang/lib/CodeGen/CodeGenModule.h
  tools/clang/test/CodeGen/sanitize-init-order.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4203.10601.patch
Type: text/x-patch
Size: 19794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140619/ba4bdd30/attachment.bin>


More information about the llvm-commits mailing list