<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - clang still uses compiler-rt symbols on x86_32 when -nodefaultlibs is being used"
   href="https://llvm.org/bugs/show_bug.cgi?id=28712">28712</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang still uses compiler-rt symbols on x86_32 when -nodefaultlibs is being used
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>krejzi@email.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm using clang version 3.9.0 (branches/release_39 276574) on my x86_64 Linux
install, with compiler-rt as the default runtime lib. I use clang for both 32
and 64 bit software (multilib).

There's an issue with programs that specify -nostdlib/-nodefaultlibs and are
built for x86_32 target. The built programs seem to reference the compiler-rt
symbols anyways, and because libclang_rt.builtins isn't being linked in, the
link process fails. The same program doesn't happen for programs built for
x86_64 target using the same compiler.

../coregrind/link_tool_exe_linux 0x38000000 clang     -o memcheck-x86-linux
-m32 -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith
-Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual
-Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers
-fno-stack-protector -fno-strict-aliasing -fno-builtin -Wno-cast-align
-Wno-self-assign -Wno-tautological-compare -fomit-frame-pointer -O2 -static
-nodefaultlibs -nostartfiles -u _start  -m32 memcheck_x86_linux-mc_leakcheck.o
memcheck_x86_linux-mc_malloc_wrappers.o memcheck_x86_linux-mc_main.o
memcheck_x86_linux-mc_translate.o memcheck_x86_linux-mc_machine.o
memcheck_x86_linux-mc_errors.o ../coregrind/libcoregrind-x86-linux.a
../VEX/libvex-x86-linux.a
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-m_execontext.o):
In function `vgPlain_print_ExeContext_stats':
/sources/valgrind-3.11.0/coregrind/m_execontext.c:196: undefined reference to
`__udivdi3'
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-m_libcproc.o):
In function `vgPlain_read_millisecond_timer':
/sources/valgrind-3.11.0/coregrind/m_libcproc.c:953: undefined reference to
`__udivdi3'
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-m_mallocfree.o):
In function `add_one_block_to_stats':
/sources/valgrind-3.11.0/coregrind/m_mallocfree.c:1662: undefined reference to
`__udivdi3'
/sources/valgrind-3.11.0/coregrind/m_mallocfree.c:1662: undefined reference to
`__udivdi3'
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-m_transtab.o):
In function `vgPlain_print_tt_tc_stats':
/sources/valgrind-3.11.0/coregrind/m_transtab.c:2435: undefined reference to
`__udivdi3'

All those functions are part of compiler-rt's libclang_rt.builtins-i386.a or
the x86_64 counterpart.</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>