<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 - Make -thinlto-index-only work well with thin static archives"
   href="https://bugs.llvm.org/show_bug.cgi?id=42717">42717</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Make -thinlto-index-only work well with thin static archives
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>akhuang@google.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rnk@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, llvm@inglorion.net, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Many build systems (such as LLVM's) are organized as collections of static
archives. Currently, the recommended way to use -thinlto-index-only to
distribute LTO backend actions is to use --start-lib / --end-lib on the command
line:
<a href="http://lists.llvm.org/pipermail/llvm-dev/2019-June/133145.html">http://lists.llvm.org/pipermail/llvm-dev/2019-June/133145.html</a>

To ease adoption of thinlto in legacy build systems, LLD should at least handle
thin archives, if not true static archives. There is a discussion of some of
these issues and how to solve them here:
<a href="https://reviews.llvm.org/D64461#1586526">https://reviews.llvm.org/D64461#1586526</a>

It boils down to coming up with a good path for the .thinlto.bc file calculated
here:
<a href="http://llvm-cs.pcc.me.uk/lib/LTO/LTO.cpp#1206">http://llvm-cs.pcc.me.uk/lib/LTO/LTO.cpp#1206</a>

With a very Chromium / LLVM perspective on things, I think the ideal index file
name would be something like:

${pathtoobj}/${object_noext}.o   # stage1 output
${pathtoobj}/${object_noext}.${binary_noext}.thinlto.bc # index file
${pathtoobj}/${object_noext}.${binary_noext}.imports  # import list
${pathtoobj}/${object_noext}.${binary_noext}.o        # native output

So, for chromium on Windows, we'd have:

obj/v8/v8_libbase/bits.obj
obj/v8/v8_libbase/bits.d8.thinlto.bc
obj/v8/v8_libbase/bits.d8.o
obj/v8/v8_libbase/bits.chrome_child.thinlto.bc
obj/v8/v8_libbase/bits.chrome_child.o
... one per thinlto binary

I (think?) today the current behavior is that every link will attempt to write
obj/v8/v8_libbase/bits.thinlto.bc, which won't work if the same object is
compiled into two binaries.

Amy expressed interest in working on this.</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>