[PATCH] D11681: [asan] Print VAs instead of RVAs for module offsets on Windows

Reid Kleckner rnk at google.com
Fri Jul 31 10:34:00 PDT 2015


rnk created this revision.
rnk added reviewers: samsonov, majnemer.
rnk added a subscriber: llvm-commits.

This is consistent with binutils and ASan behavior on other platforms,
and makes it easier to use llvm-symbolizer with WinASan.

An RVA is a "relative virtual address", meaning it is the address of
something inside the image minus the base of the mapping at runtime.

A VA in this context is an RVA plus the "preferred base" of the module,
and not a real runtime address. The real runtime address of a symbol
will equal the VA iff the module is loaded at its preferred base at
runtime.

On Windows, the preferred base is stored in the ImageBase field of one
of the PE file header, and this change adds the necessary code to
extract it. On Linux, this offset is typically included in program and
section headers of executables.

ELF shared objects typically use a preferred base of zero, meaning the
smallest p_vaddr field in the program headers is zero. This makes it so
that PIC and PIE module offsets come out looking like RVAs, but they're
actually VAs. The difference between them simply happens to be zero.

http://reviews.llvm.org/D11681

Files:
  lib/sanitizer_common/sanitizer_win.cc
  test/asan/TestCases/Windows/unsymbolized.cc
  test/asan/lit.cfg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11681.31133.patch
Type: text/x-patch
Size: 7403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150731/f62b7cc7/attachment.bin>


More information about the llvm-commits mailing list