<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Some builtins are not compiled for my arch (while GCC does)"
   href="https://bugs.llvm.org/show_bug.cgi?id=52053">52053</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Some builtins are not compiled for my arch (while GCC does)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>builtins
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>stormbyte@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25318" name="attach_25318" title="Testcase minimal">attachment 25318</a> <a href="attachment.cgi?id=25318&action=edit" title="Testcase minimal">[details]</a></span>
Testcase minimal

I am doing some tests without using any GCC component (Clang with compiler-rt,
using libcxx) I discovered I am prevented from building static executables due
to missing builtins for 64bit (of course having llvm-libunwind and libcxx{,abi}
compiled to static).

Calling with verbose mode I get the following output when compiling the
attached test program with clang++ -o /tmp/test /tmp/test.cpp -static -v

clang version 13.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/13/bin
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/usr/lib/llvm/13/bin/clang-13" -cc1 -triple x86_64-pc-linux-gnu -emit-obj
-mrelax-all --mrelax-relocations -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name test.cpp -static-define -mrelocation-model
static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic
-debugger-tuning=gdb -v -resource-dir
/usr/lib/llvm/13/bin/../../../../lib/clang/13.0.0 -internal-isystem
/usr/include/c++/v1 -internal-isystem
/usr/lib/llvm/13/bin/../../../../lib/clang/13.0.0/include -internal-isystem
/usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions
-fexceptions -fcolor-diagnostics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o
/tmp/test-4b6785.o -x c++ /tmp/test.cpp
clang -cc1 version 13.0.0 based upon LLVM 13.0.0libcxx default target
x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/v1
 /usr/lib/llvm/13/bin/../../../../lib/clang/13.0.0/include
 /usr/include
End of search list.
 "/usr/bin/ld.lld" --eh-frame-hdr -m elf_x86_64 -static -o /tmp/test
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/crti.o
/usr/lib/llvm/13/bin/../../../../lib/clang/13.0.0/lib/linux/clang_rt.crtbegin-x86_64.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0
-L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/lib
-L/usr/lib/llvm/13/bin/../lib -L/lib -L/usr/lib /tmp/test-4b6785.o -lc++ -lm
--start-group
/usr/lib/llvm/13/bin/../../../../lib/clang/13.0.0/lib/linux/libclang_rt.builtins-x86_64.a
-l:libunwind.a -lc --end-group
/usr/lib/llvm/13/bin/../../../../lib/clang/13.0.0/lib/linux/clang_rt.crtend-x86_64.o
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/crtn.o
ld.lld: error: undefined symbol: __multf3
<span class="quote">>>> referenced by strtod_l.c:309 (../stdlib/strtod_l.c:309)
>>>               strtof128_l.o:(round_and_return) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a
>>> referenced by strtod_l.c:193 (../stdlib/strtod_l.c:193)
>>>               strtof128_l.o:(round_and_return) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a
>>> referenced by strtod_l.c:205 (../stdlib/strtod_l.c:205)
>>>               strtof128_l.o:(round_and_return) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a
>>> referenced 4 more times
>>> did you mean: __muldf3
>>> defined in: /usr/lib/llvm/13/bin/../../../../lib/clang/13.0.0/lib/linux/libclang_rt.builtins-x86_64.a</span >

ld.lld: error: undefined symbol: __addtf3
<span class="quote">>>> referenced by strtod_l.c:353 (../stdlib/strtod_l.c:353)
>>>               strtof128_l.o:(round_and_return) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a
>>> did you mean: __adddf3
>>> defined in: /usr/lib/llvm/13/bin/../../../../lib/clang/13.0.0/lib/linux/libclang_rt.builtins-x86_64.a</span >

ld.lld: error: undefined symbol: __unordtf2
<span class="quote">>>> referenced by printf_fphex.c:207 (../stdio-common/printf_fphex.c:207)
>>>               printf_fphex.o:(__printf_fphex) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a
>>> referenced by printf_fphex.c:207 (../stdio-common/printf_fphex.c:207)
>>>               printf_fphex.o:(__printf_fphex) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a
>>> referenced by printf_fp.c:389 (/tmp/portage/sys-libs/glibc-2.33-r7/work/glibc-2.33/stdio-common/printf_fp.c:389)
>>>               printf_fp.o:(__printf_fp_l) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a
>>> referenced 1 more times</span >

ld.lld: error: undefined symbol: __letf2
<span class="quote">>>> referenced by printf_fphex.c:207 (../stdio-common/printf_fphex.c:207)
>>>               printf_fphex.o:(__printf_fphex) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a
>>> referenced by printf_fp.c:389 (/tmp/portage/sys-libs/glibc-2.33-r7/work/glibc-2.33/stdio-common/printf_fp.c:389)
>>>               printf_fp.o:(__printf_fp_l) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libc.a</span >
clang-13: error: linker command failed with exit code 1 (use -v to see
invocation)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>