The example below has worked fine with Clang 15 and also with Clang 16 branch of a week ago.
#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.
The example below has worked fine with Clang 15 and also with Clang 16 branch of a week ago.