foniod / redbpf

Rust library for building and running BPF/eBPF modules
Apache License 2.0
1.71k stars 134 forks source link

ParseError(Reloc) on master #353

Open JosuGZ opened 1 year ago

JosuGZ commented 1 year ago

I'm trying to run this program, which is compiled with clang:

#include <linux/bpf.h>
#define SEC(NAME) __attribute__((section(NAME), used))

SEC("tracepoint/syscalls/sys_enter_execve")
int bpf_prog(void *ctx) {
  char msg[] = "Hello, BPF World!\n";
  bpf_trace_printk(msg, sizeof(msg));

  return 0;
}

char _license[] SEC("license") = "GFPL";

On version = "2.3.0" it seems to work, but tracepoints_mut() is not present and I think I need that to make the program do something. Loader::load() returns an Ok.

On master it complains about this: ParseError(Reloc).

I'm new to this so any advice is welcomed. Perhaps I should not load programs compiled from c with clang with this library.