<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55971>55971</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISCV] -finstr-profile-generate fails to with error "Unsupported relocation type"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:RISC-V
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
topperc
</td>
</tr>
</table>
<pre>
We end up in `RISCVELFObjectWriter::getRelocType` with `Kind==FK_Data_8` and `IsPCRel==true`. This isn't handled in the switch.
I believe the offending code is this
`.quad .L__profc_foo-.L__profd_foo`
I think we should be generating a R_RISCV_ADD64 and R_RISCV_SUB64 pair for this. I suspect `requiresFixups` isn't returning true when it needs to.
https://godbolt.org/z/xcvdsG7c9
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxdUttuozAQ_Rp4GQVxCZA88JCWzSpqpV2lt0dk8ADeupj60rT79TsmjaquZLBnPDNnzhm3in9UTwg4cXAziAmCIj4e7q4ff9zuf7V_sLNPWljUQbajNaA9olTd_ceMFAgnYUefcSMmHmQ1rf1NUzPLmo2_ZlSV9oP5fU1p5wCrnU-N4H4UBoSZgrS0MFKoRO4bsCOCocLdGAVxHcS78_8ALUqBb7gEqL6nlsU0QKc4UhnyCvMZT9VfHeMAEN02zaxV3zW9UquLxb1FUd_LU4HpGU4EPionOcHBgBNqZj0Mg2Oz6NLs6rpYL9QunruHK_LMTGjolV46ieAAxpmZ9PMKaHx1QqPZi3c3Gy_NhbhG6_TkEbwwcBpxAmFhQuTESX2TYLSWkmkQ6Z7WoHirpI2UHsj6S99798bNz7LbhrzK-DbbstAKK7EK8qul0yCvYdWLyVi98kIIiatPjgg9E9JDnoeKWhOVIE0fJuPmWWlL09F-9qSHoin5F5CmodOy-q8vSndt1KkXMqR8u2we0b8nMoUxDg0d8nxbJuFYIVtvsWftOme8LbKsLDKeFS3maZykvF-HktH0jSdCoC3rntE_uJ1ntXokFzELRZXGaRoXSRynWZ4kUb8t8nyTZP2mjJGVSbCO8YVYRr4dr1uoq6Wz1g2GLqUw1nxdMmPEQINYUKk-c3ZUurJqnlF34UKiWhj8A9M3DU8">