[llvm-dev] Require -funwind-tables for compiler-rt on ARM?

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Sun Jun 16 15:04:56 PDT 2019

I recently debugged an issue where I wasn't getting stack traces from ASAN on 32-bit ARM (on Android) when using a libclang_rt.asan-arm-android.so I'd built myself. I finally ended up tracing it to a build issue; the CMake build check for -funwind-tables was failing (because of some missing link libraries), so compiler-rt wasn't being built with that flag, which in turn led to all backtraces failing with an error like the following:

==21748==AddressSanitizer CHECK failed: …/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc:116 "((count)) < ((size))" (0x0, 0x0)
    <empty stack>

I'm not entirely sure why omitting -funwind-tables would result in this outcome. I guess stack walking on ARM relies on those tables; I was building with -fno-omit-frame-pointer, but perhaps frame pointer walking isn't sufficient. I'd appreciate more insight here.

Regardless of the root cause, however, if -funwind-tables is required for stack traces to work on ARM, should we make it required in the CMake build config? I'm gonna enforce the use of the flag locally (by adding it to the global compile flags, so we at least get a loud compile/link error if something's wrong with our setup instead of a silent CMake configuration check failure), but I was wondering if this was something that should be upstream as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190616/2feeddab/attachment.html>

More information about the llvm-dev mailing list