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

    <tr>
        <th>Summary</th>
        <td>
            Clang 18 Seg Fault compiling Xanmod Kernel with LTO
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Xanmod kernel version: https://github.com/xanmod/linux/releases/tag/6.6.21-rt26-xanmod1

Clang version:
```
clang version 18.1.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/18/bin
Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg
```

Stacktrace:
```
DESCEND objtool
make[4]: 'install_headers' is up to date.
CALL scripts/checksyscalls.sh
LD      vmlinux.o
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ld.lld -m elf_x86_64 -mllvm -import-instr-limit=5 -z noexecstack -r -o vmlinux.o -T .tmp_initcalls.lds --whole-archive vmlinux.a --no-whole-archive --start-group --end-group
1.      Running pass 'Function Pass Manager' on module 'ld-temp.o'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@ip6_rcv_core'
#0 0x00007f5c4b9b4696 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x3bb9696)
#1 0x00007f5c4b9b20f0 llvm::sys::RunSignalHandlers() (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x3bb70f0)
#2 0x00007f5c4b9b4dd4 (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x3bb9dd4)
#3 0x00007f5c4798cd50 (/lib64/libc.so.6+0x3bd50)
#4 0x00007f5c4c2442d0 (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x44492d0)
#5 0x00007f5c4c313e16 (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x4518e16)
#6 0x00007f5c4c31323d llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x451823d)
#7 0x00007f5c4c3d3229 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x45d8229)
#8 0x00007f5c4c3d2312 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x45d7312)
#9 0x00007f5c4c3cfc0e llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x45d4c0e)
#10 0x00007f5c4eedd59f (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x70e259f)
#11 0x00007f5c4be384f0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x403d4f0)
#12 0x00007f5c4bb327ff llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x3d377ff)
#13 0x00007f5c4bb39f73 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x3d3ef73)
#14 0x00007f5c4bb33581 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x3d38581)
#15 0x00007f5c4d41d9b8 (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x56229b8)
#16 0x00007f5c4d41c8d7 llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x56218d7)
#17 0x00007f5c4d40a06d llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x560f06d)
#18 0x00007f5c4d409670 llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x560e670)
#19 0x00007f5c4fc031e8 lld::elf::BitcodeCompiler::compile() (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x1dd1e8)
#20 0x00007f5c4fb6b004 void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::endianness)1, true>>(bool) (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x145004)
#21 0x00007f5c4fb5cc36 lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x136c36)
#22 0x00007f5c4fb4ae13 lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x124e13)
#23 0x00007f5c4fb49495 lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x123495)
#24 0x00007f5c4f6fd5b3 lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/usr/lib/llvm/18/bin/../lib64/liblldCommon.so.18.1+0x175b3)
#25 0x000056534b288a37 lld_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm/18/bin/ld.lld+0x3a37)
#26 0x000056534b289324 main (/usr/lib/llvm/18/bin/ld.lld+0x4324)
#27 0x00007f5c47976f0a (/lib64/libc.so.6+0x25f0a)
#28 0x00007f5c47976fc5 __libc_start_main (/lib64/libc.so.6+0x25fc5)
#29 0x000056534b288881 _start (/usr/lib/llvm/18/bin/ld.lld+0x3881)
Segmentation fault
make[2]: *** [scripts/Makefile.vmlinux_o:62: vmlinux.o] Error 139
make[1]: *** [/usr/src/linux-6.6.21_p26-xanmod/Makefile:1301: vmlinux_o] Error 2
make: *** [Makefile:234: __sub-make] Error 2
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWU1v4zgS_TXKhZAhkfo85OD4IxusM9NoB4u5GZRYkjmhSC9FpZP99QtKsiM67u7pGc8u0IFhKyTFeu9VkSypaNvyWgLcevGdFy9vaGf2St8-SAP6QLsWbgrF3m5_o7JRDD2DliDQC-iWK-mROdobc2g9Mvfw2sPrmpt9V8xK1Xh4_drf4-G14LJ79fBagwDaQuvhtaG1h9fJLJnh0NcGJ_4wOvSCpRfMh--FoLKeGBv7kmD89P-W00EozGbhbOx5oroGY0G-ZskuifxD6fdQ_Fp245C9BspQoxgIO_CgWv46dD3I1lAhgC25tl0eXnet7tkU9lu8WI5h5uF1weUIWMmK152mxmKpuIDxTjClh9c9VCvMRzh-3zcrq_oiyeF7a2j5bDQt4WtiLFfbxeqXJVLF70YpMTQ29Bm8-C7y4uUAJ-UDt90eKAPdejhFvEXdARmFGDUwG-nMNxvUlpofjPVZuYfyuX1rSypEO2v3w6DNEvV_L01PZqaG5k-b1Xy7Qm1XNNwgioquRhoOShtr5BtRMwprf_yDVr9DaTy85m3b9YGDq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