<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 [ELF]: linker crashes on -static link."
   href="https://llvm.org/bugs/show_bug.cgi?id=25762">25762</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD [ELF]: linker crashes on -static link.
          </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>Windows NT
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>grimar@accesssoftek.com
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Simple program crashes the linker. Looks like eh_frame sections require some
additional handling. 

test.cpp:
#include <stdio.h>
int main() {
   printf("Static boom !\n");
   return 0;
}

~/LLVM/build/bin/clang -static -fuse-ld=lld test.cpp -o test
./test

ld.lld: /home/umb/LLVM/llvm/include/llvm/Support/Casting.h:237: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
lld::elf2::MergeInputSection<llvm::object::ELFType<(llvm::support::endianness)1u,
true> >; Y =
lld::elf2::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1u,
true> >; typename llvm::cast_retty<X, Y*>::ret_type =
lld::elf2::MergeInputSection<llvm::object::ELFType<(llvm::support::endianness)1u,
true> >*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"' failed.
#0 0x000000000050794c llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/umb/LLVM/llvm/lib/Support/Unix/Signals.inc:322:0
#1 0x0000000000507ca0 PrintStackTraceSignalHandler(void*)
/home/umb/LLVM/llvm/lib/Support/Unix/Signals.inc:380:0
#2 0x00000000005061e7 llvm::sys::RunSignalHandlers()
/home/umb/LLVM/llvm/lib/Support/Signals.cpp:44:0
#3 0x000000000050736d SignalHandler(int)
/home/umb/LLVM/llvm/lib/Support/Unix/Signals.inc:210:0
#4 0x00007f174730dd10 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10d10)
#5 0x00007f174673b267 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35267)
#6 0x00007f174673ceca abort (/lib/x86_64-linux-gnu/libc.so.6+0x36eca)
#7 0x00007f174673403d (/lib/x86_64-linux-gnu/libc.so.6+0x2e03d)
#8 0x00007f17467340f2 (/lib/x86_64-linux-gnu/libc.so.6+0x2e0f2)
#9 0x0000000001f94ded
llvm::cast_retty<lld::elf2::MergeInputSection<llvm::object::ELFType<(llvm::support::endianness)1,
true> >,
lld::elf2::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,
true> >*>::ret_type
llvm::cast<lld::elf2::MergeInputSection<llvm::object::ELFType<(llvm::support::endianness)1,
true> >,
lld::elf2::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,
true> >
<span class="quote">>(lld::elf2::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,</span >
true> >*) /home/umb/LLVM/llvm/include/llvm/Support/Casting.h:239:0
#10 0x0000000001fbedad
llvm::object::ELFFile<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::uintX_t</span >
lld::elf2::getLocalRelTarget<llvm::object::ELFType<(llvm::support::endianness)1,
true>,
true>(lld::elf2::ObjectFile<llvm::object::ELFType<(llvm::support::endianness)1,
true> > const&,
llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1,
true>, true> const&) /home/umb/LLVM/llvm/tools/lld/ELF/OutputSections.cpp:861:0
#11 0x0000000001f97306 void
lld::elf2::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::relocate<true>(unsigned char*, unsigned char*,
llvm::iterator_range<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1,
true>, true> const*>) /home/umb/LLVM/llvm/tools/lld/ELF/InputSection.cpp:155:0
#12 0x0000000001f93b63
lld::elf2::InputSection<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::writeTo(unsigned char*)
/home/umb/LLVM/llvm/tools/lld/ELF/InputSection.cpp:215:0
#13 0x0000000001fb644f
lld::elf2::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::writeTo(unsigned char*)
/home/umb/LLVM/llvm/tools/lld/ELF/OutputSections.cpp:904:0
#14 0x000000000200f9ec (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections() /home/umb/LLVM/llvm/tools/lld/ELF/Writer.cpp:1088:0</span >
#15 0x0000000002006b24 (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::run() /home/umb/LLVM/llvm/tools/lld/ELF/Writer.cpp:151:0</span >
#16 0x0000000002028f9d void
lld::elf2::writeResult<llvm::object::ELFType<(llvm::support::endianness)1,
true>
<span class="quote">>(lld::elf2::SymbolTable<llvm::object::ELFType<(llvm::support::endianness)1,</span >
true> >*) /home/umb/LLVM/llvm/tools/lld/ELF/Writer.cpp:138:0
#17 0x0000000001f6dc1a void
lld::elf2::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(llvm::opt::InputArgList&)
/home/umb/LLVM/llvm/tools/lld/ELF/Driver.cpp:290:0
#18 0x0000000001f6adcf lld::elf2::LinkerDriver::main(llvm::ArrayRef<char
const*>) /home/umb/LLVM/llvm/tools/lld/ELF/Driver.cpp:129:0
#19 0x0000000001f699d9 lld::elf2::link(llvm::ArrayRef<char const*>)
/home/umb/LLVM/llvm/tools/lld/ELF/Driver.cpp:34:0
#20 0x0000000000408404 lld::UniversalDriver::link(llvm::MutableArrayRef<char
const*>, llvm::raw_ostream&)
/home/umb/LLVM/llvm/tools/lld/lib/Driver/UniversalDriver.cpp:209:0
#21 0x0000000000407397 main
/home/umb/LLVM/llvm/tools/lld/tools/lld/lld.cpp:36:0
#22 0x00007f1746726a40 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20a40)
#23 0x0000000000407249 _start (/home/umb/LLVM/build/bin/lld+0x407249)</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>