This is an archive of the discontinued LLVM Phabricator instance.

Teach `DlAddrSymbolizer::SymbolizeData` how to find symbol size
AbandonedPublic

Authored by ismailp on Aug 6 2015, 6:37 AM.

Details

Summary

When sanitizers report a problem around a global symbol, error report
contains symbol size. However, sizes of global symbols are 0 on
Darwin, because Dl_info doesn't have a field for symbol size.

This patch calculates the symbol size as the distance from given symbol
to next symbol in the same section, or to the end of section, if there
is no next symbol. The result is greater than or equal to the actual
size of symbol. Currently, only 64-bit Mach-O images are supported.

Diff Detail

Event Timeline

ismailp updated this revision to Diff 31446.Aug 6 2015, 6:37 AM
ismailp retitled this revision from to Teach `DlAddrSymbolizer::SymbolizeData` how to find symbol size.
ismailp updated this object.
ismailp added reviewers: kubamracek, glider, kcc, samsonov.
ismailp added a subscriber: llvm-commits.
samsonov edited edge metadata.Aug 7 2015, 5:18 PM

I would really like to avoid it, and instead claim that llvm-symbolizer is required to properly symbolize global variables. FWIW we have the same situation on Linux, where addr2line can't symbolize global objects. I don't think we will walk ELF symbol tables in sanitizer runtimes, thus copying the logic from LLVM's libObject.

lib/sanitizer_common/sanitizer_symbolizer_mac.cc
22

It's disallowed to use libstdc++ / libc++ in sanitizer runtimes.

ismailp abandoned this revision.Aug 22 2015, 5:10 AM

OK, that makes sense. Thanks!