<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61412>61412</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISCV] Clang-16 regressing build of inline assembly with Unsupported relocation type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kraj
</td>
</tr>
</table>
<pre>
The example below has worked fine with clang-15 and also with clang16 branch of a week ago.
```c
#define XREF_NOTE \
"" "\n"\
" .type _frr_xref_note,@object" "\n"\
" .pushsection .note.FRR,\"a\",@note" "\n"\
" .p2align 2" "\n"\
"_frr_xref_note:" "\n"\
" .long 9" "\n"\
" .long 16" "\n"\
" .ascii \"XREF\"" "\n"\
" .ascii \"FRRouting\\0\\0\\0\"" "\n"\
" .quad __start_xref_array-." "\n"\
" .quad __stop_xref_array-." "\n"\
" .size _frr_xref_note, .-_frr_xref_note" "\n"\
" .popsection" "\n"\
"" "\n"\
void foo(void) {
asm(XREF_NOTE);
}
```
```
clang -target riscv64-yoe-linux -mlittle-endian b.c -c
b.c:18:7: error: Unsupported relocation type
asm(XREF_NOTE);
^
b.c:11:3: note: expanded from macro 'XREF_NOTE'
" .quad __start_xref_array-." "\n"\
^
<inline asm>:10:8: note: instantiated into assembly here
.quad __start_xref_array-.
^
b.c:18:7: error: Unsupported relocation type
asm(XREF_NOTE);
^
b.c:12:3: note: expanded from macro 'XREF_NOTE'
" .quad __stop_xref_array-." "\n"\
^
<inline asm>:11:8: note: instantiated into assembly here
.quad __stop_xref_array-.
^
2 errors generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8lt-PozYQx_8a8zICgQ0EHnjIZTdSX1opvVZ9iwxMwLeOTW2z2fSvrwzs3V5ufyRVW2uFMdZ8PfPZ8WS4taJTiBXJPpHsLuCj67WpHgz_EtS6PVefewR84sdBItQo9Ql6buGkzQO2cBAK4SRcD43kqguTDLhqgUurX3xOcqgNV00P-gAcTogPwDsdkfiOxOvlmcfzX7OsKWtxkv9jd7_d__zL53sg2WbeBEIpoXSaso2ap2VrGX57HpE7Dwj7gzH7J4OHvdIOCd2QNNb1F2zc9ULDaHuLjRNaQeRlou1u56WyDaGUz9MsPR_ybPnD-OC8aKBcik4BfUfjFm1C6QUAtr4-bqlVBwDlzRZJfr0Jt40QADNE_z9_xnmbwGy13e306ITq_DLbxD9O9CO0b2B8Pu3PkbcAsN9bx42bwXJj-DmMrnf5hYge_qGGFX-9kt0QhZffXo32w0TUw5Lxt2fiGwTfCG1-PmrRwkFrQgv_SmgJZPVpMeb2SGjxtR4QWhK27JHV3UUdebW4zMupKEHouOnQgRG2eczT8KwxlEKNTxAepXBOYoiqFVxBHTUQLnWpjhrC1klB2HpF2BrQGG38y2_KjsOgjcMWDErd8KlO-OLzsfsLsOz-u0MSwtbMay83FvBp4Kr1ddfoIxx5YzQQunohubom125M2G9-EbYRSvqi7GNh997JmLB18dJJoazjygnuSQjlNHBr8VjLM_Ro8Hvtd91aUuaCyv-Cnv5H6G-75u-TT_418pdeXYCnM2oLHSo0Xj26uFdBW7G2ZCUPsEryVVHQuMjzoK8ODU9ozOo4S1l24DHFOGvitEzTgpZFzgNR0ZiymCVpUsarNI9apAUrCpY1GOdlU5I0xiMXMpLy8Rhp0wXC2hGrPEkTGkheo7RT80KpwhNMmxPLu8BU3iasx86SNJbCOvtNxQknp65n99Ovm99JdgebuYXJwWBn0FqhOqhHIVvftnylvwCdupt3Ei8Yjax65wY7_dRuCd12wvVjHTX6SOjW-7FM4WD03IhsJ-8todspur8DAAD__-Olj7U">