<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/106203>106203</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [RISC-V][ORCJIT] PostgreSql JIT crashes in llvm::RuntimeDyldELF::computePlaceholderAddress
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          andreas-schwab
      </td>
    </tr>
</table>

<pre>
    When postgresql is configured with --with-llvm the regression testsuite causes a lot of crashed that all look like this:

#0  std::_Deque_iterator<llvm::SectionEntry, llvm::SectionEntry&, llvm::SectionEntry*>::_M_set_node (__new_node=0x19db8a08, this=<optimized out>)
    at /usr/lib64/gcc/riscv64-suse-linux/13/../../../../include/c++/13/bits/stl_deque.h:266
#1 std::_Deque_iterator<llvm::SectionEntry, llvm::SectionEntry&, llvm::SectionEntry*>::operator+= (__n=<optimized out>, this=<optimized out>)
    at /usr/lib64/gcc/riscv64-suse-linux/13/../../../../include/c++/13/bits/stl_deque.h:241
#2 std::operator+ (__x=..., __n=<optimized out>)
    at /usr/lib64/gcc/riscv64-suse-linux/13/../../../../include/c++/13/bits/stl_deque.h:400
#3 std::_Deque_iterator<llvm::SectionEntry, llvm::SectionEntry&, llvm::SectionEntry*>::operator[] (this=<optimized out>, __n=<optimized out>)
    at /usr/lib64/gcc/riscv64-suse-linux/13/../../../../include/c++/13/bits/stl_deque.h:255
#4 std::deque<llvm::SectionEntry, std::allocator<llvm::SectionEntry> >::operator[] (this=<optimized out>, __n=<optimized out>)
    at /usr/lib64/gcc/riscv64-suse-linux/13/../../../../include/c++/13/bits/stl_deque.h:1386
#5 llvm::RuntimeDyldELF::computePlaceholderAddress (this=<optimized out>, 
 SectionID=<optimized out>, Offset=848)
    at /usr/src/debug/llvm-18.1.8.src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:1086
#6 0x0000003f83fc33ca in llvm::RuntimeDyldImpl::resolveRelocationList (
 this=0xb117b80, Relocs=..., Value=0)
    at /usr/src/debug/llvm-18.1.8.src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:1106
#7 llvm::RuntimeDyldImpl::applyExternalSymbolRelocations (this=0xb117b80, 
 ExternalSymbolMap=<error reading variable: Cannot access memory at address 0x18>)
    at /usr/src/debug/llvm-18.1.8.src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:1119
#8 0x000000000a287310 in ?? ()

IIUC RuntimeDyld is part of MC JIT and should not be used by ORC JIT.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzclt9u4jgUxp_G3FhE_pNAuOCCApEYTdVROzt7iRz7QLxj4tR2KOzTr5xQoNotvdrtaBEyin049vfLl5MjvNfbGmCKsjuULQaiDZV1U1ErB8IPvaxeRDkorTpOf6-gxo31YevAPxusPZa23uht60DhFx0qPBzGn6Ex-x0OFWAHMdZrW-MAPvhWB8BStB48FtjYgO0GSyd8BQqHSgQsjMHG2p_Y6J-AQ6U94jNEFoi8jowTjH1QcZ7P1gt4bmGtAzgRrEN8Hjfv155ABm3rZR3cEbE5fm9ldGtxhvjytNX92kNY11YBRixfr2t46a4QX5ADnagyFySPufpjLxCf2ybonf4TFLZtiJnYpJeBMcYiYMSK1jvECqPLUYpYsZUSscJpL_ejdOhbD0Oj6_aAWEE5YkWS_H3QtTStAsQKidhd9-2DSx08YoUPZq0ipqRCfMZGozNJ-ikgbXPag90hvjixfI_Xr04zpWea7ELzSmKv74D4Ion55_iG2E-XkxJylsM_1xxdPYrwbt3_X5smy7IzzfRCswu4yfAcKoyx8jZyvsT_S3iU55dClV0557Gtg97B4mjU8mvRz0m7a9oA34yQUFmjwM2Uiq-ejxmcdJ6YrhbvRz5sNh4C4os8zd8F5F0Eo6BstxGX2e-GNE9okif9itElYsXyALLt7-FW1xHJlaq3V8uvRSKbJhIhV0RGm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