<html>
    <head>
      <base href="http://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 --- - Option --rtlib=compiler-rt points to non-existent runtime library."
   href="http://llvm.org/bugs/show_bug.cgi?id=19822">19822</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Option --rtlib=compiler-rt points to non-existent runtime library.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>compiler-rt
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>eocallaghan@alterapraxis.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang version 3.5.0 (trunk 209083)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Hi,

Consider this simple example:

int main(void)
{
  long long x = 10;
  long long z = x / 3; // generates call to __udivdi3

  return 0;
}


on a x64 host. Note that we have,
$ ls -l /usr/local/bin/../lib/clang/3.5.0/lib/linux/
 20K -rw-r--r-- 1 root root  20K May 18 14:04 libclang_rt.asan_cxx-x86_64.a
4.1M -rw-r--r-- 1 root root 4.1M May 18 14:04 libclang_rt.asan-x86_64.a
740K -rw-r--r-- 1 root root 740K May 18 14:04 libclang_rt.dfsan-x86_64.a
220K -rw-r--r-- 1 root root 218K May 18 14:04 libclang_rt.full-x86_64.a
940K -rw-r--r-- 1 root root 940K May 18 14:04 libclang_rt.lsan-x86_64.a
2.4M -rw-r--r-- 1 root root 2.4M May 18 14:04 libclang_rt.msan-x86_64.a
 28K -rw-r--r-- 1 root root  25K May 18 14:04 libclang_rt.profile-x86_64.a
676K -rw-r--r-- 1 root root 674K May 18 14:04 libclang_rt.san-x86_64.a
3.3M -rw-r--r-- 1 root root 3.3M May 18 14:04 libclang_rt.tsan-x86_64.a
 24K -rw-r--r-- 1 root root  22K May 18 14:04 libclang_rt.ubsan_cxx-x86_64.a
100K -rw-r--r-- 1 root root  98K May 18 14:04 libclang_rt.ubsan-x86_64.a


While attempting to cross compile to a i386 target observe the invocation:
clang -m32 --rtlib=compiler-rt foo.c 
/..//bin/ld: cannot find crtbegin.o: No such file or directory
/..//bin/ld: cannot find
/usr/local/bin/../lib/clang/3.5.0/lib/linux/libclang_rt.i386.a: No such file or
directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

of course we don't have 'libclang_rt.i386.a'. However, further the
--rtlib=compiler-rt option is even broken on the native target:

clang --rtlib=compiler-rt foo.c 
/usr/bin/ld: cannot find
/usr/local/bin/../lib/clang/3.5.0/lib/linux/libclang_rt.x86_64.a: No such file
or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

of course 'libclang_rt.x86_64.a' does not exist as we have the naming
convention libclang_rt.XXX-x86_64.a


Hence we have two problems here:
1.) The frontend option '--rtlib=compiler-rt' is both poorly documented and
broken. In fact, random bug reports on Google is how I found out about it then
I had to look at the frontend.
2.) No multilib support to cross compile from x86_64 to i386 target.

This currently blocks building coreboot with clang. Please advise..
Cheers,
Edward.</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>