<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" 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=us-ascii">
<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:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.Code, li.Code, div.Code
        {mso-style-name:Code;
        mso-style-link:"Code Char";
        margin:0in;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        font-size:9.0pt;
        font-family:"Courier New";}
p.CodeCxSpFirst, li.CodeCxSpFirst, div.CodeCxSpFirst
        {mso-style-name:CodeCxSpFirst;
        mso-style-link:"Code Char";
        mso-style-type:export-only;
        margin:0in;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        font-size:9.0pt;
        font-family:"Courier New";}
p.CodeCxSpMiddle, li.CodeCxSpMiddle, div.CodeCxSpMiddle
        {mso-style-name:CodeCxSpMiddle;
        mso-style-link:"Code Char";
        mso-style-type:export-only;
        margin:0in;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        font-size:9.0pt;
        font-family:"Courier New";}
p.CodeCxSpLast, li.CodeCxSpLast, div.CodeCxSpLast
        {mso-style-name:CodeCxSpLast;
        mso-style-link:"Code Char";
        mso-style-type:export-only;
        margin:0in;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        font-size:9.0pt;
        font-family:"Courier New";}
span.CodeChar
        {mso-style-name:"Code Char";
        mso-style-link:Code;
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:14.0pt">This is on the master branch of LLVM (11.0.0). I am using clang-7.1.0 to make the build on a CentOS6.6 machine. The complete cmake command line is also below. Any hints on how to resolve this build failure?
 Note that I am using: </span><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXXABI_USE_COMPILER_RT=ON -DLIBCXXABI_USE_LLVM_UNWINDER=ON
</span><span style="font-size:14.0pt">as I am creating a self-contained clang toolchain that does not depend on libgcc. The 64-bit version builds fine (only 32-bit fails).
</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt">The problem seems to be that in 32-bit builds, clang now generates a call to __udivdi3 in cxa_demangle.cpp.o but when linking libc++abi.so results in an the undefined symbol. I am not sure if getting libc++abi.so
 to be linked with libclang_rt.builtins (which contains the definition of __udivdi3) is the correct fix. I haven’t looked at why
</span><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXXABI_USE_COMPILER_RT=ON</span><span style="font-size:14.0pt">  doesn’t result in libc++abi.so to be linked with compiler-rt builtins. Can anyone familiar with this stuff comment on this?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">projects/libcxxabi/src/CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o: In function `(anonymous namespace)::itanium_demangle::SyntheticTemplateParamName::printLeft((anonymous namespace)::itanium_demangle::OutputStream&)
 const':                                             cxa_demangle.cpp:(.text._ZNK12_GLOBAL__N_116itanium_demangle26SyntheticTemplateParamName9printLeftERNS0_12OutputStreamE+0x12a): undefined reference to `__udivdi3'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">cmake -G Ninja -DLLVM_PATH=/u/riyaz/src/llvm-project/llvm \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;mlir;openmp \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLLVM_TARGETS_TO_BUILD=X86 \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLLVM_BUILD_32_BITS=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLLVM_ENABLE_ZLIB=OFF \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLLVM_ENABLE_LIBCXX=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXXABI_USE_COMPILER_RT=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXXABI_USE_LLVM_UNWINDER=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXXABI_ENABLE_SHARED=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXX_USE_COMPILER_RT=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXX_ENABLE_SHARED=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=OFF \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DSANITIZER_USE_COMPILER_RT=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DSANITIZER_CXX_ABI=libc++ \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBOMP_USE_COMPILER_RT=ON \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DCMAKE_INSTALL_PREFIX=/u/tools/llvm-11.0.0/linux \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DCMAKE_BUILD_TYPE=Release \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DCMAKE_EXE_LINKER_FLAGS="-rtlib=compiler-rt" \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DCMAKE_SHARED_LINKER_FLAGS="-rtlib=compiler-rt" \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DCMAKE_MODULE_LINKER_FLAGS="-rtlib=compiler-rt" \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DCMAKE_CXX_COMPILER=/u/tools/llvm-7.1.0/linux64/bin/clang++ \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DCMAKE_C_COMPILER=/u/tools/llvm-7.1.0/linux64/bin/clang \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBOMP_COPY_EXPORTS=FALSE \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-DLIBOMP_CFLAGS=-stdlib=libc++ \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">/u/riyaz/src/llvm-project/llvm<o:p></o:p></span></p>
</div>
</body>
</html>