[llvm-bugs] [Bug 25762] New: LLD [ELF]: linker crashes on -static link.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 7 02:22:52 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25762

            Bug ID: 25762
           Summary: LLD [ELF]: linker crashes on -static link.
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: grimar at accesssoftek.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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> >
>(lld::elf2::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,
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>
>::uintX_t
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>
>::writeSections() /home/umb/LLVM/llvm/tools/lld/ELF/Writer.cpp:1088:0
#15 0x0000000002006b24 (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
>::run() /home/umb/LLVM/llvm/tools/lld/ELF/Writer.cpp:151:0
#16 0x0000000002028f9d void
lld::elf2::writeResult<llvm::object::ELFType<(llvm::support::endianness)1,
true>
>(lld::elf2::SymbolTable<llvm::object::ELFType<(llvm::support::endianness)1,
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)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151207/354242ea/attachment-0001.html>


More information about the llvm-bugs mailing list