<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Thanks for the bug report; that makes sense.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">And I should have been clearer … I meant specifically requiring -funwind-tables for the sanitizers, since they all require some form of unwinding. compiler-rt's build adds -funwind-tables to the sanitizer compile flags if its configure
 check succeeded: <a href="https://github.com/llvm/llvm-project/blob/a8dcd47688764faf90c44dfefd0cc321b3e8d9df/compiler-rt/CMakeLists.txt#L274">
https://github.com/llvm/llvm-project/blob/a8dcd47688764faf90c44dfefd0cc321b3e8d9df/compiler-rt/CMakeLists.txt#L274</a>. I'm wondering if for ARM (and any other architecture with similar issues) we should error if the configure check for -funwind-tables failed
 and you're building a sanitizer.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Peter Smith <peter.smith@linaro.org><br>
<b>Date: </b>Monday, June 17, 2019 at 5:48 AM<br>
<b>To: </b>Shoaib Meenai <smeenai@fb.com><br>
<b>Cc: </b>"llvm-dev@lists.llvm.org" <llvm-dev@lists.llvm.org><br>
<b>Subject: </b>Re: [llvm-dev] Require -funwind-tables for compiler-rt on ARM?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Sun, 16 Jun 2019 at 23:05, Shoaib Meenai via llvm-dev<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #B5C4DF 4.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-right:0in" id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE">
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">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:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">==21748==AddressSanitizer CHECK failed: …/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc:116 "((count)) < ((size))" (0x0, 0x0)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">     <empty stack><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">My limited understanding is that there are some interoperability<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">problems with LLVM and GCC. There seems to be more detail in<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><a href="https://github.com/google/sanitizers/issues/640">https://github.com/google/sanitizers/issues/640</a> and<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.llvm.org_show-5Fbug.cgi-3Fid-3D18505&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=gloGzWLvQehqVjUWtDshS2N9dX-wrp5jRMGbMkWehFc&s=AWCiHDguLChQEvWdZxiJ5uAwsfQotIY_mkXhVgxXmDQ&e=">https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.llvm.org_show-5Fbug.cgi-3Fid-3D18505&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=gloGzWLvQehqVjUWtDshS2N9dX-wrp5jRMGbMkWehFc&s=AWCiHDguLChQEvWdZxiJ5uAwsfQotIY_mkXhVgxXmDQ&e=</a>
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<blockquote style="border:none;border-left:solid #B5C4DF 4.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-right:0in" id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE">
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">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.<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Adding -funwind-tables by default could add to the overall code-size,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">this might not be appreciated in cases where unwinding isn't required,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">particularly bare-metal builds for cortex-m where ASAN won't be used.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">There may be a case for requiring it for A profile architectures,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">particularly if ASAN is also being built.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Peter<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<blockquote style="border:none;border-left:solid #B5C4DF 4.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-right:0in" id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE">
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">_______________________________________________<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">LLVM Developers mailing list<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=gloGzWLvQehqVjUWtDshS2N9dX-wrp5jRMGbMkWehFc&s=D563qkpgzqZd9o9xubusR-2_PvxNEBMSt7pSzxuXoqA&e=">https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=gloGzWLvQehqVjUWtDshS2N9dX-wrp5jRMGbMkWehFc&s=D563qkpgzqZd9o9xubusR-2_PvxNEBMSt7pSzxuXoqA&e=</a>
<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
</div>
</body>
</html>