<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - crash with relocation in mergeable section"
   href="https://bugs.llvm.org/show_bug.cgi?id=43767">43767</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash with relocation in mergeable section
          </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>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>rafael@espindo.la
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given

--------------------------------------------------------
foo:                                                                            
        .long 42                                                                

        .section        .rodata.cst8,"aM",@progbits,8                           
bar:
        .quad   foo

--------------------------------------------------------

running

$ ld.lld -r foo.o -o bar.o

crashes with

ld.lld: /home/espindola/llvm-project/llvm/include/llvm/Support/Casting.h:308:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast_or_null(Y*) [with X =
lld::elf::SyntheticSection; Y = lld::elf::SectionBase; typename
llvm::cast_retty<X, Y*>::ret_type = lld::elf::SyntheticSection*]: Assertion
`isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!"' failed.
Stack dump:
0.      Program arguments: /home/espindola/llvm-project/build/bin/ld.lld -r
foo.o -o bar.o
 #0 0x0000000003e75d26 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/espindola/llvm-project/llvm/lib/Support/Unix/Signals.inc:544:22
 #1 0x0000000003e75db9 PrintStackTraceSignalHandler(void*)
/home/espindola/llvm-project/llvm/lib/Support/Unix/Signals.inc:605:1
 #2 0x0000000003e73f10 llvm::sys::RunSignalHandlers()
/home/espindola/llvm-project/llvm/lib/Support/Signals.cpp:68:20
 #3 0x0000000003e75776 SignalHandler(int)
/home/espindola/llvm-project/llvm/lib/Support/Unix/Signals.inc:391:1
 #4 0x00007f81f90a6c60 __restore_rt (/lib64/libpthread.so.0+0x12c60)
 #5 0x00007f81f89e5e35 raise
/usr/src/debug/glibc-2.29-32-g6d8eaf4a25/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #6 0x00007f81f89d0895 abort
/usr/src/debug/glibc-2.29-32-g6d8eaf4a25/stdlib/abort.c:81:7
 #7 0x00007f81f89d0769 _nl_load_domain.cold
/usr/src/debug/glibc-2.29-32-g6d8eaf4a25/intl/loadmsgcat.c:1177:9
 #8 0x00007f81f89de566 (/lib64/libc.so.6+0x30566)
 #9 0x000000000408cbd5 llvm::cast_retty<lld::elf::SyntheticSection,
lld::elf::SectionBase*>::ret_type
llvm::cast_or_null<lld::elf::SyntheticSection,
lld::elf::SectionBase>(lld::elf::SectionBase*)
/home/espindola/llvm-project/llvm/include/llvm/Support/Casting.h:308:3
#10 0x0000000004086114 lld::elf::MergeInputSection::getParent() const
/home/espindola/llvm-project/llvm/tools/lld/ELF/InputSection.cpp:1223:1
#11 0x0000000004083701 lld::elf::SectionBase::getOutputSection()
/home/espindola/llvm-project/llvm/tools/lld/ELF/InputSection.cpp:200:25
#12 0x00000000040abded
lld::elf::addInputSec(llvm::StringMap<llvm::TinyPtrVector<lld::elf::OutputSection*>,
llvm::MallocAllocator>&, lld::elf::InputSectionBase*, llvm::StringRef)
/home/espindola/llvm-project/llvm/tools/lld/ELF/LinkerScript.cpp:591:70
#13 0x00000000040ac2bf
lld::elf::LinkerScript::addOrphanSections()::'lambda'(lld::elf::InputSectionBase*)::operator()(lld::elf::InputSectionBase*)
const /home/espindola/llvm-project/llvm/tools/lld/ELF/LinkerScript.cpp:689:57
#14 0x00000000040af30c std::_Function_handler<void
(lld::elf::InputSectionBase*),
lld::elf::LinkerScript::addOrphanSections()::'lambda'(lld::elf::InputSectionBase*)>::_M_invoke(std::_Any_data
const&, lld::elf::InputSectionBase*&&)
/usr/include/c++/9/bits/std_function.h:302:7
#15 0x00000000040b497f std::function<void
(lld::elf::InputSectionBase*)>::operator()(lld::elf::InputSectionBase*) const
/usr/include/c++/9/bits/std_function.h:690:71
#16 0x00000000040ac55b lld::elf::LinkerScript::addOrphanSections()
/home/espindola/llvm-project/llvm/tools/lld/ELF/LinkerScript.cpp:717:8
#17 0x0000000003fec9d0 void
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(llvm::opt::InputArgList&)
/home/espindola/llvm-project/llvm/tools/lld/ELF/Driver.cpp:1951:36
#18 0x0000000003fd8778 lld::elf::LinkerDriver::main(llvm::ArrayRef<char
const*>) /home/espindola/llvm-project/llvm/tools/lld/ELF/Driver.cpp:500:5
#19 0x0000000003fd5302 lld::elf::link(llvm::ArrayRef<char const*>, bool,
llvm::raw_ostream&)
/home/espindola/llvm-project/llvm/tools/lld/ELF/Driver.cpp:113:3
#20 0x0000000003ddd899 main
/home/espindola/llvm-project/llvm/tools/lld/tools/lld/lld.cpp:154:12
#21 0x00007f81f89d1f43 __libc_start_main
/usr/src/debug/glibc-2.29-32-g6d8eaf4a25/csu/../csu/libc-start.c:342:3
#22 0x0000000003ddcbee _start
(/home/espindola/llvm-project/build/bin/ld.lld+0x3ddcbee)</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>