<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64925>64925</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Crash in ld.lld with LTO
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          stomah
      </td>
    </tr>
</table>

<pre>
    ```
0.      Program arguments: /usr/bin/ld.lld --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o chess /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crti.o /usr/bin/../lib/gcc/x86_64-redhat-linux/13/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-redhat-linux/13 -L/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib -plugin-opt=mcpu=x86-64 /tmp/chess-14a9c9.o /tmp/buf_writer-95992f.o /tmp/core_io-e06966.o /tmp/dyn_array-1f67f0.o /tmp/fd-30fbd9.o /tmp/format-757a74.o /tmp/memory-9d9e52.o /tmp/optional_ptr-9bbfe9.o /tmp/string-e7d74f.o -lSDL2 -lSDL2_image -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-redhat-linux/13/crtend.o /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crtn.o
 #0 0x00007fa4a24c350a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-16.so+0xcc350a)
 #1 0x00007fa4a24c0e94 llvm::sys::RunSignalHandlers() (/lib64/libLLVM-16.so+0xcc0e94)
 #2 0x00007fa4a24c40bb (/lib64/libLLVM-16.so+0xcc40bb)
 #3 0x00007fa4a125fb70 __restore_rt (/lib64/libc.so.6+0x3db70)
 #4 0x00007fa4a302773d (/lib64/libLLVM-16.so+0x182773d)
 #5 0x00007fa4a3026fc7 (/lib64/libLLVM-16.so+0x1826fc7)
 #6 0x00007fa4a2fff985 (/lib64/libLLVM-16.so+0x17ff985)
 #7 0x00007fa4a2fff28c llvm::BitcodeModule::readSummary(llvm::ModuleSummaryIndex&, llvm::StringRef, unsigned long, std::function<bool (unsigned long)>) (/lib64/libLLVM-16.so+0x17ff28c)
 #8 0x00007fa4a3cb9471 llvm::lto::LTO::addModule(llvm::lto::InputFile&, unsigned int, llvm::lto::SymbolResolution const*&, llvm::lto::SymbolResolution const*) (/lib64/libLLVM-16.so+0x24b9471)
 #9 0x00007fa4a3cb90f1 llvm::lto::LTO::add(std::unique_ptr<llvm::lto::InputFile, std::default_delete<llvm::lto::InputFile>>, llvm::ArrayRef<llvm::lto::SymbolResolution>) (/lib64/libLLVM-16.so+0x24b90f1)
#10 0x00007fa4a8f1e975 lld::elf::BitcodeCompiler::add(lld::elf::BitcodeFile&) (/lib64/liblldELF.so.16+0x11e975)
#11 0x00007fa4a8e925ad lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/lib64/liblldELF.so.16+0x925ad)
#12 0x00007fa4a8e87ad5 lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/lib64/liblldELF.so.16+0x87ad5)
#13 0x00007fa4a8e86543 lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/lib64/liblldELF.so.16+0x86543)
#14 0x00000000004043f9 (/usr/bin/ld.lld+0x4043f9)
#15 0x0000000000403b25 lld_main(int, char**) (/usr/bin/ld.lld+0x403b25)
#16 0x00007fa4a1249b4a __libc_start_call_main (/lib64/libc.so.6+0x27b4a)
#17 0x00007fa4a1249c0b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c0b)
#18 0x00000000004037e5 _start (/usr/bin/ld.lld+0x4037e5)
clang-16: error: unable to execute command: Segmentation fault (core dumped)
clang-16: error: linker command failed due to signal (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0V12PGysS_TX4BWG16e8HP0zG8W4kR_cqE-1ri4bqNntp8AKdjP_9CtozdnucGetGN4rGLShOnToUVcCck70GWKP8E8o3Czb6vbFr583A9ovWiOMaFcnpf7JByUOyREn9pzW9ZQNmth8H0N6h9AEjuh2dRXTbSo3oVomlUgITsmduT5w_KkDpptcjJqQdpRJEhlnYk86yAcheWEwGDKprnquiKTJMxFGzQXKipP4LbHCgZFtkETwMjs_kuSpIkS2dWVJMDOZ7cO6ayXI5rUR023OO6HbCJxbEnvkJCNHtKn2xvfrz4pRbv1qafxBd_h46t76FXuqlwWT3d3F-Y-l7AU6wE8r16OTs9pyS7ZURJgc19lITc_Ao3Qz8MKJ0M-VBUM8Ph6BFSASyyljN60nVabwdu-anlR4sqfO6pt3lJDcWGmkIJEVdFJcz4qgbZi07klVXlF1yOdcJkiZdK2Z-OmMH5kmZl6zMLicGGIw9klrUkNPLCXPw0mimmoO3pG7bDmaAzlupewKlKLNAmqinzY6efho5sB4wUQMmquccE8Ic0QACxDTSOEyINrNhfr_x72UlaPGPnhu9NFNxwoimCU6ekyRJyo5ljGY8zROGlfoxoPQBpQ_u6KaPP63U_skz_td3yzggWp2NLPvZGOctsAHRAtFHLLVHtMaIVpdVSLa73X--klWxdAbRT8kzj-4Qrc98Vld8EqizW3y-jfpJ9pqpfzMtFFgXfd3jMiDOXNIrl1nStnfgBLMZTnqJs6J515YJbhoLzoeTYv1bUB5KcREBU9GWyQwvu8RLE1qWqfiQ16qKdjOg_Aqo6Hh5D1CwmwEVM6W6rqur_GOgMtrNgMprIFrxi13-JD03Ar4aMYY2GHMMmHgah4HZ4yz3JpvTzBct4PmUgmeTp1gLvkEXhkcdW7jAyug-DDgvJrNu1DzUFJQ-ts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