<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 - LLD segfaults when linking the Aarch64 Linux kernel with ThinLTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=44277">44277</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD segfaults when linking the Aarch64 Linux kernel with ThinLTO
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>vsk@apple.com
          </td>
        </tr>

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

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, ndesaulniers@google.com, ruiu@google.com, tejohnson@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Starting with commit 30038da15b18ac4e34b9ea7a648382ae481e4770 ("[DWARF] Allow
cross-CU references of subprogram definitions"), building the Linux kernel with
ThinLTO and LLD fails with a segmentation fault:

  ...
  LTO     vmlinux.o
Stack dump:
0.      Running pass 'Function Pass Manager' on module
'arch/arm64/built-in.a(kernel/time.o at 4094)'.
1.      Running pass 'AArch64 Assembly Printer' on function '@time_init'
LLVM ERROR: Failed to rename temporary file .thinlto-cache/Thin-d28bbb.tmp.o to
.thinlto-cache/llvmcache-C22016E1D1853F1DBC0C29919ED2F9B7CDF8E084: No such file
or directory

LLVM ERROR: Failed to rename temporary file .thinlto-cache/Thin-d9b995.tmp.o to
.thinlto-cache/llvmcache-BE7211A526D6D732AC88F1C1BCEC23592806F256: No such file
or directory

LLVM ERROR: Failed to rename temporary file .thinlto-cache/Thin-99c344.tmp.o to
.thinlto-cache/llvmcache-C7FECFD0C0C51CF353CF7961D21F44C1A8E02A6A: No such file
or directory

scripts/link-vmlinux.sh: line 71: 100211 Segmentation fault      ${LD}
${KBUILD_LDFLAGS} -r -o ${1} $(lto_lds) ${objects}
make: *** [Makefile:1136: vmlinux] Error 139


Steps to reproduce:

 $ git clone <a href="https://github.com/samitolvanen/linux.git">https://github.com/samitolvanen/linux.git</a>
 $ cd linux
 $ git checkout clang-lto
 $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CC=clang LD=ld.lld 
 defconfig
 $ ./scripts/config -e LTO_CLANG -e THINLTO
 $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CC=clang LD=ld.lld -j110


I've confirmed that reverting commit 30038da15b18ac4e34b9ea7a648382ae481e4770
fixes the issue.

Note that not passing --thinlto-cache-dir to LLD removes the "Failed to rename
temporary file" errors, but still results in a segfault.</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>