<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 segfault in InputSection::writeTo linking FreeBSD/i386 gptboot loader (reproducer attached)"
   href="https://llvm.org/bugs/show_bug.cgi?id=31295">31295</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld segfault in InputSection::writeTo linking FreeBSD/i386 gptboot loader (reproducer attached)
          </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>FreeBSD
          </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>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>emaste@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>23214
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17729" name="attach_17729" title="lld segfault reproducer">attachment 17729</a> <a href="attachment.cgi?id=17729&action=edit" title="lld segfault reproducer">[details]</a></span>
lld segfault reproducer

Linking the gpt bootloader, which is an i386 binary on FreeBSD/amd64.

Boot log excerpt:

--- gptboot.out ---
ld -static -N --gc-sections -m elf_i386_fbsd -Ttext 0x0 -o gptboot.out
/tank/emaste/obj/tank/emaste/src/freebsd-xlld/sys/boot/i386/gptboot/../btx/lib/crt0.o
gptboot.o sio.o crc32.o drv.o cons.o util.o xform_aes_xts.o
/tank/emaste/obj/tank/emaste/src/freebsd-xlld/sys/boot/i386/gptboot/../../geli/libgeliboot.a
/tank/emaste/obj/tank/emaste/src/freebsd-xlld/sys/boot/i386/gptboot/../../libstand32/libstand.a


Backtrace excerpt:

(lldb) bt
* thread #5: tid = 102169, 0x00000008065eaf46 libc.so.7`memcpy + 22 at
bcopy.S:65, stop reason = invalid address (fault address: 0x9051b1090)
  * frame #0: 0x00000008065eaf46 libc.so.7`memcpy + 22 at bcopy.S:65
    frame #1: 0x000000000068d084
ld.lld`lld::elf::InputSection<llvm::object::ELFType<(this=0x00000008074f3320,
Buf=0x00000009051b1000)1, false> >::writeTo(unsigned char*) + 372 at
InputSection.cpp:596
    frame #2: 0x000000000081be40 ld.lld`operator(this=0x00007fffdf7f9bd8,
IS=0x00000008074f3320) + 32 at OutputSections.cpp:256
    frame #3: 0x000000000081db6c ld.lld`operator() [inlined]
lld::elf::OutputSection<llvm::object::ELFType<(__first=__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<1,
false> > **> at 0x00007fffdf7f9be8,
__last=__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<1, false> > **>
at 0x00007fffdf7f9be0, __f=l
ld::elf::OutputSection<llvm::object::ELFType<llvm::support::endianness, false>
<span class="quote">>::<anonymous class> at 0x00007fffdf7f9bd8)1, false> >::writeTo(unsigned</span >
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >*) 
std::__1::for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >**>, lld::elf::Output
Section<llvm::object::ELFType<(llvm::support::endianness)1, false>
<span class="quote">>::writeTo(unsigned</span >
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false>
<span class="quote">>*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,</span >
false> >**>,
std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
fa
lse> >**>,
lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >::writeTo(unsigned
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >*)) + 93 at algorithm:853
    frame #4: 0x000000000081db0f ld.lld`operator(this=0x0000000808810078) + 191
at Parallel.h:307
    frame #5: 0x000000000081da3c ld.lld`std::__1::__function::__func<void
lld::parallel_for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >**>,
lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >::writeTo(unsigned
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false>
<span class="quote">>*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,</span >
false> >**>,
std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >**>,
lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >::writeTo(unsigned
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >*))::'lambda'(), std::__1::allocator<void
lld::parallel_for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >**>,
lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >::writeTo(unsigned
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false>
<span class="quote">>*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,</span >
false> >**>, std::__1::__wrap_iter<lld::elf:
:InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>,
lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >::writeTo(unsigned
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >*))::'lambda'()>, void ()>::operator()
() [inlined] decltype(this=0x0000000808810078, __f=0x0000000808810078)1, false>
<span class="quote">>**> >(fp)(std::__1::forward<>(fp0))) std::__1::__invoke<void</span >
lld::parallel_for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::spport::endianness)1,
false> >**>,
lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >::writeTo(unsigned
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false>
<span class="quote">>*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,</span >
false> >**>,
std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >**>,
lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false> >::writeTo(unsigned
char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
false>
<span class="quote">>*))::'lambda'()&>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,</span >
false> >**>&&) + 60 
at __functional_base:413</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>