<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 --- - llvm build with -flto installs libclang_rt.* archives that contain bitcode"
   href="http://llvm.org/bugs/show_bug.cgi?id=18279">18279</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm build with -flto installs libclang_rt.* archives that contain bitcode
          </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>octoploid@yandex.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>When llvm is build with -flto installs libclang_rt.* archives that contain
bitcode.

For example:

markus@x4 ~ % clang -fsanitize=undefined -O2 -g un.c
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.0/../../../../x86_64-pc-linux-gnu/bin/ld:
error: /usr/local/bin/../lib/clang/3.4/lib/linux/libclang_rt.san-x86_64.a:
member at 812 is not an ELF object
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.0/../../../../x86_64-pc-linux-gnu/bin/ld:
error: /usr/local/bin/../lib/clang/3.4/lib/linux/libclang_rt.san-x86_64.a:
member at 44656 is not an ELF object
...
un.c:3: error: undefined reference to '__ubsan_handle_shift_out_of_bounds'
clang-3.4: error: linker command failed with exit code 1 (use -v to see
invocation)

(-flto works fine, because it enables the linker plugin:)
markus@x4 ~ % clang -flto -fsanitize=undefined -O2 -g un.c
markus@x4 ~ % 

(enabling the linker plugin by hang also works:)
markus@x4 ~ % clang -Wl,-plugin /usr/local/bin/../lib/LLVMgold.so
-Wl,-plugin-opt=mcpu=x86-64 -fsanitize=undefined -O2 -g un.c
markus@x4 ~ %  

One solution would be to always disable -flto for compiler-rt during the build.
Another one to enable the linker plugin by default for -flto builds in general.</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>