You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aya/test/integration-test/bpf/pointer_reloc.bpf.c

22 lines
571 B
C

#include "reloc.h"
struct relocated_struct_with_pointer {
#ifndef TARGET
struct relocated_struct_with_pointer *first;
#endif
struct relocated_struct_with_pointer *second;
#ifdef TARGET
struct relocated_struct_with_pointer *first;
#endif
};
__noinline int pointer_global() {
struct relocated_struct_with_pointer s = {
(struct relocated_struct_with_pointer *)42,
(struct relocated_struct_with_pointer *)21,
};
return set_output((__u64)__builtin_preserve_access_index(s.first));
}
SEC("uprobe") int program(void *ctx) { return pointer_global(); }