<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 - libclang_rt.scudo[_minimal]-<arch>.a contains LLVM IR files when compiling with ThinLTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=43722">43722</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libclang_rt.scudo[_minimal]-<arch>.a contains LLVM IR files when compiling with ThinLTO
          </td>
        </tr>

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

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

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

        <tr>
          <th>Component</th>
          <td>scudo
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>aaronpuchert@alice-dsl.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following five object files in libclang_rt.scudo-x86_64.a and
libclang_rt.scudo_minimal-x86_64.a are LLVM IR files instead of ELF objects
when building with LLVM_ENABLE_LTO=Thin:

  guarded_pool_allocator_posix.cpp.o
  mutex_posix.cpp.o
  guarded_pool_allocator.cpp.o
  random.cpp.o
  backtrace_linux_libc.cpp.o

This is problematic if users want to link with the static library, which then
contains a mix of LLVM IR and ELF object files.

The files come from gwp_asan, where the targets are for some reason built
without SANITIZER_COMMON_CFLAGS (see lib/gwp_asan/CMakeLists.txt), which
contains -fno-lto.

The issue can be reproduced by configuring a build with -DLLVM_ENABLE_LTO=Thin
and then running

<span class="quote">> ar x <...>/libclang_rt.scudo-x86_64.a
> file *</span >
backtrace_linux_libc.cpp.o:         LLVM IR bitcode
guarded_pool_allocator.cpp.o:       LLVM IR bitcode
guarded_pool_allocator_posix.cpp.o: LLVM IR bitcode
interception_linux.cc.o:            ELF 64-bit LSB relocatable, x86-64, version
1 (SYSV), with debug_info, not stripped
interception_mac.cc.o:              ELF 64-bit LSB relocatable, x86-64, version
1 (SYSV), not stripped
interception_type_test.cc.o:        ELF 64-bit LSB relocatable, x86-64, version
1 (SYSV), not stripped
interception_win.cc.o:              ELF 64-bit LSB relocatable, x86-64, version
1 (SYSV), not stripped
mutex_posix.cpp.o:                  LLVM IR bitcode
options_parser.cpp.o:               ELF 64-bit LSB relocatable, x86-64, version
1 (SYSV), with debug_info, not stripped
random.cpp.o:                       LLVM IR bitcode
sancov_flags.cc.o:                  ELF 64-bit LSB relocatable, x86-64, version
1 (SYSV), with debug_info, not stripped
...</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>