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

    <tr>
        <th>Summary</th>
        <td>
            objcopy crash
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          douglas-raillard-arm
      </td>
    </tr>
</table>

<pre>
    llvm-objcopy dies when inspecting some sections of an object file generated by rustc.
The tool is in version 18, installed on Ubuntu following the llvm.sh recipe at https://apt.llvm.org/

```
llvm-objdump-18 -h /tmp/tmpoync5nx4/generated/rust/rust.o_objdump.o | awk '{ print $2 }' | grep '^.binstore.c.' | xargs -n1 sh -c 'cp -f /tmp/tmpoync5nx4/generated/rust/rust.o /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o && llvm-objcopy-18 --dump-section $0=/tmp/tmpoync5nx4/generated/rust/rust_c_shims/shim_$0 /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o /dev/null'
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llvm-objcopy-18 --dump-section .binstore.c.header.__lisa_c_shim_constant_assert_50141894102302112148172994662096862652=/tmp/tmpoync5nx4/generated/rust/rust_c_shims/shim_.binstore.c.header.__lisa_c_shim_constant_assert_50141894102302112148172994662096862652 /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o /dev/null
 #0 0x00007f823c643716 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd94716)
 #1 0x00007f823c6416d0 llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd926d0)
 #2 0x00007f823c643ddb (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd94ddb)
 #3 0x00007f823b49c520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f823dd5a580 llvm::objcopy::elf::SectionWriter::visit(llvm::objcopy::elf::Section const&) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24ab580)
 #5 0x00007f823dd5b483 llvm::objcopy::elf::Section::accept(llvm::objcopy::elf::SectionVisitor&) const (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24ac483)
 #6 0x00007f823dd751c0 llvm::objcopy::elf::ELFWriter<llvm::object::ELFType<(llvm::endianness)1, true> >::write() (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24c61c0)
 #7 0x00007f823dd563bb (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24a73bb)
 #8 0x00007f823dd56701 llvm::objcopy::elf::executeObjcopyOnBinary(llvm::objcopy::CommonConfig const&, llvm::objcopy::ELFConfig const&, llvm::object::ELFObjectFileBase&, llvm::raw_ostream&) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24a7701)
 #9 0x00007f823dd494b7 llvm::objcopy::executeObjcopyOnBinary(llvm::objcopy::MultiFormatConfig const&, llvm::object::Binary&, llvm::raw_ostream&) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x249a4b7)
#10 0x00005631df095f69 (/usr/lib/llvm-18/bin/llvm-objcopy+0x21f69)
#11 0x00007f823c628390 llvm::writeToOutput(llvm::StringRef, std::function<llvm::Error (llvm::raw_ostream&)>) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd79390)
#12 0x00005631df0956f3 (/usr/lib/llvm-18/bin/llvm-objcopy+0x216f3)
#13 0x00005631df096006 (/usr/lib/llvm-18/bin/llvm-objcopy+0x22006)
#14 0x00007f823b483d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#15 0x00007f823b483e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#16 0x00005631df07cac5 (/usr/lib/llvm-18/bin/llvm-objcopy+0x8ac5)
```
</pre>
<img width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