<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63671>63671</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Crash using JITLink on RISC-V with linker relaxation
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:RISC-V,
jitlink
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hahnjo
</td>
</tr>
</table>
<pre>
The following C++ snippet defines global `std::vector<int>` and pushes a single element in `main`:
```c++
#include <vector>
std::vector<int> v;
int main() {
v.push_back(42);
return 0;
}
```
After compiling with `clang++ -S -emit-llvm global-vector.push.cpp`, "interpretation" works fine with `lli -mattr=+d global-vector.push.ll`, but crashes with `lli -mattr=+d,+relax global-vector.push.ll`.
I tried debugging and selectively disabling relaxation of certain instructions. It seems the problem is introduced by relaxing the call to `_ZNSt6vectorIiSaIiEE9push_backEOi` into a `jal` (because `RD = 1`), but I fail to understand why - a number of other relaxations of the same pattern work just fine.
/cc @mtvec
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0lM9u4zYQxp-GugxsyJQsWwcd4n-Ai6IFNoseellQ5FgahyIFcuQ0b19QdrNJsQEM2xqRv5nvmyFVjNQ5xEasd2J9yNTEvQ9Nr3p39VnrzVvzvUe4eGv9K7kO9kLuhNxBdDSOyGDwQg4jdNa3yoKo8shGFE-ieLqhZh9EsSfHojiKKgflDIxT7DGCgkiuswhocUDHQC7tHhQ5UeWJkB9E_pT-zx99T_yIyoKctpNBEMX-v0THx8v5-6sy4CaK3ceF5BjmrHIrZA1i83gLcFumWn-0Sr8IuS2lkPX7XoCAPAUH-U_c5vC_mj-mebowBtB-GMkmI1-J-yRYW-W6h6mLZ1jgQLyw9jY8LF3c659LWepxTFi5ByElOcYwBmTF5J2QEl59eImQGvKOt5ZgMSjmIIqDkDvzK6y1Dyq0E4MOau7Qlwgh0xQEtOqfL2nLj9rPwIHQgMF26rqkPg1CRIua6Yb2DQxF1c6-zNhZEfgLaAysyAG5yGHSKRyXcGaIiEME7hHG4FuLA1AEchy8mTQaaN_upIRMq7SyFtgnPT_-_uOZq3vFZ3pWZzoe6_dOH_-kNKnk2INKy68q6QEhty1qNUVMwW8HEMUBVrNvdbIuOXeGi6I5zeQMhshJ5mv_BgtQ4KahxZBEee4xfBAaUzAVGdWAMCpmDG5uJlynyHNDP_kp5ElrEGU-8A01ZKYpTF3UKsNmVW23ZV2XZZ31jV7r1cqsVpUpTb41Ul826tK2a3MpzXq9rTNqZC6LfJOXq7rYyHqpSlltclVtlGlXeb4VZY6DIrtME7n0ocsoxgmbqqg2q8yqFm2c7w4pk3no0qH7dn7eL_4SUs6DIq_EltxLel4fstAk1KKduijK3FLk-BPOxBabfRpAmNL9AL-dv_9O7gW8gzv2PpYJ-MnDbAq26ZnHmE69PAl56oj7qV1qPwh5SikeP4sx-CtqFvI0i4lCnmY9_wYAAP__d_iYIw">