mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-11 11:09:06 +08:00
libbpf: Use weak hidden modifier for USDT BPF-side API functions
Use __weak __hidden for bpf_usdt_xxx() APIs instead of much more confusing `static inline __noinline`. This was previously impossible due to libbpf erroring out on CO-RE relocations pointing to eliminated weak subprogs. Now that previous patch fixed this issue, switch back to __weak __hidden as it's a more direct way of specifying the desired behavior. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20220408181425.2287230-3-andrii@kernel.org
This commit is contained in:
committed by
Andrii Nakryiko
parent
5016f30a24
commit
1ce956ab3a
@@ -103,7 +103,7 @@ int __bpf_usdt_spec_id(struct pt_regs *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return number of USDT arguments defined for currently traced USDT. */
|
/* Return number of USDT arguments defined for currently traced USDT. */
|
||||||
static inline __noinline
|
__weak __hidden
|
||||||
int bpf_usdt_arg_cnt(struct pt_regs *ctx)
|
int bpf_usdt_arg_cnt(struct pt_regs *ctx)
|
||||||
{
|
{
|
||||||
struct __bpf_usdt_spec *spec;
|
struct __bpf_usdt_spec *spec;
|
||||||
@@ -124,7 +124,7 @@ int bpf_usdt_arg_cnt(struct pt_regs *ctx)
|
|||||||
* Returns 0 on success; negative error, otherwise.
|
* Returns 0 on success; negative error, otherwise.
|
||||||
* On error *res is guaranteed to be set to zero.
|
* On error *res is guaranteed to be set to zero.
|
||||||
*/
|
*/
|
||||||
static inline __noinline
|
__weak __hidden
|
||||||
int bpf_usdt_arg(struct pt_regs *ctx, __u64 arg_num, long *res)
|
int bpf_usdt_arg(struct pt_regs *ctx, __u64 arg_num, long *res)
|
||||||
{
|
{
|
||||||
struct __bpf_usdt_spec *spec;
|
struct __bpf_usdt_spec *spec;
|
||||||
@@ -204,7 +204,7 @@ int bpf_usdt_arg(struct pt_regs *ctx, __u64 arg_num, long *res)
|
|||||||
* utilizing BPF cookies internally, so user can't use BPF cookie directly
|
* utilizing BPF cookies internally, so user can't use BPF cookie directly
|
||||||
* for USDT programs and has to use bpf_usdt_cookie() API instead.
|
* for USDT programs and has to use bpf_usdt_cookie() API instead.
|
||||||
*/
|
*/
|
||||||
static inline __noinline
|
__weak __hidden
|
||||||
long bpf_usdt_cookie(struct pt_regs *ctx)
|
long bpf_usdt_cookie(struct pt_regs *ctx)
|
||||||
{
|
{
|
||||||
struct __bpf_usdt_spec *spec;
|
struct __bpf_usdt_spec *spec;
|
||||||
|
|||||||
Reference in New Issue
Block a user