<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56964>56964</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
bpf: support for kernel_helper attributes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jameshilliard
</td>
</tr>
</table>
<pre>
GCC currently uses [`kernel_helper`](https://gcc.gnu.org/onlinedocs/gcc/BPF-Function-Attributes.html) attributes to implement [bpf helper functions](https://github.com/gcc-mirror/gcc/blob/releases/gcc-12.1.0/gcc/config/bpf/bpf-helpers.h).
These have the advantage of working at any optimization level as well unlike [llvm style helpers](https://github.com/libbpf/libbpf/blob/v0.8.1/src/bpf_helper_defs.h).
It would be helpful to have support for these [`kernel_helper`](https://gcc.gnu.org/onlinedocs/gcc/BPF-Function-Attributes.html) attributes in llvm as they should be more reliable and allow for unified llvm/GCC bpf helper definitions.
See details:
https://lore.kernel.org/bpf/87v8s260j1.fsf@oracle.com/
https://github.com/gcc-mirror/gcc/blob/releases/gcc-12.1.0/gcc/config/bpf/bpf.cc#L838-L846
Cc: @jemarch
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFkk2PmzAQhn8NXKwgMB8xBw77oa0q7aFSe6-MGYKzg41skyj99R0gTbPSqj1VlZC_mXmfmbe13aX59PTE1OwcmIAXNnvwLCofoyp9A2cAvw-AEzjaR-VzxMUQwuSj_CHiL_QdlEoOZk6sO9DOGtQGOqv8dkXj45eX3ctsVNDW7B5CcLqdA_hkCCNGvGbydsSCZXqcEEZSskhop55tyVl_jeA_1KDDMLeJsuOWdTdq56y7SWjRtjQ5QJBEd32U8SRL0tsjZU2vFwbKuo27LTdJJZ1JlD5H6cM2fhvAAxvkCVgYgMnuJE2QB2C2Z2fr3rQ5EBeT5sLsFPSof8hFPEM4ATLp2RkQ2UzFeoMFFPE0Mh8uCFfev2Oibjeht8WV8pQmIslo4Z3aOK4N_N5B_wHL50CSZ-xYuyXvZ1wascL5eZqsC6y3bgH18J-Moal0S4mociTjwvzwS_FoHTBqrJYtFU-ajklEe14Vz0b3Grr1V8q32PzOUVQNbfTqqXf1-ApAd0FqXFnWs_dkSDmTrQRXuq0BYn8SnlfpMUt630dFap1UCNeGfRTpHxk3Wc7zV5GL3asoqnu6J0XJGWk7wiidGmJosqqs90VeFXXcNXlX57WMgw4IzRKQXt-74F3n71oUzw6bP9l168Ey7SZnj6ACbbX384pVVnVVxEOTK7FvZQqCA8iaZ9CWe1Wl-17IsueFiFG2gL5ZbMi5gTNbQ9CaLBjrhqecpyIteV4WqUj22T6vhaiEKnjGVU3chK0xWXQsvYtds0pq54OnS9Q--N-X0nt9MABrOoov5zBY1xzlCH7QSKZzXbwKaFaAnzOuubQ">