https://llvm.org/bugs/show_bug.cgi?id=25587
Bug ID: 25587 Summary: assertion failure "cast<Ty>() argument of incompatible type" when linking FreeBSD base system with lld -Bstatic Product: lld Version: unspecified Hardware: PC OS: FreeBSD Status: NEW Severity: normal Priority: P Component: All Bugs Assignee: unassignedb...@nondot.org Reporter: ema...@freebsd.org CC: llvm-bugs@lists.llvm.org Classification: Unclassified Commandline: /tank/emaste/src/freebsd-xlld/tools_bin/ld --sysroot=/tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp -Bstatic -o as /tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/usr/lib/crt1.o /tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/usr/lib/crti.o /tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/usr/lib/crtbeginT.o -L/tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/usr/lib -L/tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/lib -L/tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/usr/lib app.o as.o atof-generic.o atof-ieee.o cond.o depend.o dw2gencfi.o dwarf2dbg.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o obj-elf.o output-file.o read.o sb.o stabs.o subsegs.o symbols.o write.o tc-i386.o ../libbfd/libbfd.a ../libiberty/libiberty.a ../libopcodes/libopcodes.a -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/usr/lib/crtend.o /tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/usr/lib/crtn.o (lldb) Process 3889 launched: '/tank/emaste/src/llvm/build-debug/bin/lld' (x86_64) Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file ../include/llvm/Support/Casting.h, line 237. Process 3889 stopped (lldb) * thread #1: tid = 105373, 0x0000000805762aaa libc.so.7`__sys_thr_kill + 10 at thr_kill.S:3, stop reason = signal SIGABRT frame #0: 0x0000000805762aaa libc.so.7`__sys_thr_kill + 10 at thr_kill.S:3 1 #include "compat.h" 2 #include "SYS.h" -> 3 RSYSCALL(thr_kill) 4 .section .note.GNU-stack,"",%progbits (lldb) bt * thread #1: tid = 105373, 0x0000000805762aaa libc.so.7`__sys_thr_kill + 10 at thr_kill.S:3, stop reason = signal SIGABRT * frame #0: 0x0000000805762aaa libc.so.7`__sys_thr_kill + 10 at thr_kill.S:3 frame #1: 0x0000000805762a96 libc.so.7`__raise(s=<unavailable>) + 38 at raise.c:51 frame #2: 0x0000000805762a19 libc.so.7`abort + 73 at abort.c:65 frame #3: 0x00000008057c93c1 libc.so.7`__assert(func=<unavailable>, file=<unavailable>, line=<unavailable>, failedexpr=<unavailable>) + 81 at assert.c:54 frame #4: 0x0000000002928a29 lld`llvm::cast_retty<lld::elf2::MergeInputSection<llvm::object::ELFType<(Val=0x00000008064bd2a0)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> >*) + 73 at Casting.h:237 frame #5: 0x0000000002954e30 lld`llvm::object::ELFFile<llvm::object::ELFType<(File=0x00000008064533c0, RI=0x0000000806488020)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&) + 544 at OutputSections.h:819 frame #6: 0x000000000292cb9e lld`void lld::elf2::InputSectionBase<llvm::object::ELFType<(this=0x00000008064bd000, Buf=0x000000080705b000, BufEnd=0x000000080705b27b, Rels=iterator_range<const llvm::object::Elf_Rel_Impl<llvm::object::ELFType<1, true>, true> *> at 0x00007fffffffbef8)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*>) + 766 at InputSection.cpp:123 frame #7: 0x000000000292c819 lld`lld::elf2::InputSection<llvm::object::ELFType<(this=0x00000008064bd000, Buf=0x000000080705b000)1, true> >::writeTo(unsigned char*) + 425 at InputSection.cpp:168 frame #8: 0x00000000029671c7 lld`lld::elf2::OutputSection<llvm::object::ELFType<(this=0x0000000806c15000, Buf=0x000000080705b000)1, true> >::writeTo(unsigned char*) + 359 at OutputSections.cpp:863 frame #9: 0x0000000002a08571 lld`(anonymous namespace)::Writer<llvm::object::ELFType<(this=0x00007fffffffc430)1, true> >::writeSections() + 673 at Writer.cpp:990 frame #10: 0x00000000029ef7f8 lld`(anonymous namespace)::Writer<llvm::object::ELFType<(this=0x00007fffffffc430)1, true> >::run() + 136 at Writer.cpp:147 frame #11: 0x0000000002a36109 lld`void lld::elf2::writeResult<llvm::object::ELFType<(Symtab=0x00007fffffffd340)1, true> >(lld::elf2::SymbolTable<llvm::object::ELFType<(llvm::support::endianness)1, true> >*) + 1401 at Writer.cpp:135 frame #12: 0x00000000028f57ae lld`void lld::elf2::LinkerDriver::link<llvm::object::ELFType<(this=0x00007fffffffd990, Args=0x00007fffffffd7f0)1, true> >(llvm::opt::InputArgList&) + 2366 at Driver.cpp:287 frame #13: 0x00000000028edbf6 lld`lld::elf2::LinkerDriver::main(this=0x00007fffffffd990, ArgsArr=ArrayRef<const char *> at 0x00007fffffffd948) + 358 at Driver.cpp:126 frame #14: 0x00000000028eda60 lld`lld::elf2::link(Args=ArrayRef<const char *> at 0x00007fffffffdba0) + 144 at Driver.cpp:37 frame #15: 0x000000000044c580 lld`lld::UniversalDriver::link(args=MutableArrayRef<const char *> at 0x00007fffffffded8, diagnostics=0x000000000460e4b8) + 944 at UniversalDriver.cpp:208 frame #16: 0x000000000044c081 lld`main(argc=54, argv=0x00007fffffffdfc0) + 97 at lld.cpp:35 frame #17: 0x000000000044bf3f lld`_start(ap=<unavailable>, cleanup=<unavailable>) + 367 at crt1.c:78 (lldb) frame select 4 frame #4: 0x0000000002928a29 lld`llvm::cast_retty<lld::elf2::MergeInputSection<llvm::object::ELFType<(Val=0x00000008064bd2a0)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> >*) + 73 at Casting.h:237 234 235 template <class X, class Y> 236 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) { -> 237 assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!"); 238 return cast_convert_val<X, Y*, 239 typename simplify_type<Y*>::SimpleType>::doit(Val); 240 } (lldb) up frame #5: 0x0000000002954e30 lld`llvm::object::ELFFile<llvm::object::ELFType<(File=0x00000008064533c0, RI=0x0000000806488020)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&) + 544 at OutputSections.h:819 (lldb) up frame #6: 0x000000000292cb9e lld`void lld::elf2::InputSectionBase<llvm::object::ELFType<(this=0x00000008064bd000, Buf=0x000000080705b000, BufEnd=0x000000080705b27b, Rels=iterator_range<const llvm::object::Elf_Rel_Impl<llvm::object::ELFType<1, true>, true> *> at 0x00007fffffffbef8)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*>) + 766 at InputSection.cpp:123 120 // resolved so we don't allocate a SymbolBody. 121 const Elf_Shdr *SymTab = File->getSymbolTable(); 122 if (SymIndex < SymTab->sh_info) { -> 123 uintX_t SymVA = getLocalRelTarget(*File, RI); 124 Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA); 125 continue; 126 } (lldb) I'll see about building a reduced test case -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs