string is not stack allocated: not supported #601
-
Hi, I am trying to using The compiling message shows that
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang SockRedir ./bpf/sockops.c -- -I./bpf/headers The ELF object has been generated, but go file is not. When I remove the code below, the build is successful.
I am wondering why shall we come across the error messages, since most of the code is brorrow from the repo and we could compile it using clang. Any help would be appreciated, thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Your problem is in Replace |
Beta Was this translation helpful? Give feedback.
Your problem is in
bpf_sock_ops_ipv4
: https://github.com/SimpCosm/godemo/blob/c3d3ab845732d415e4de1df8077c395daa7703f9/sockredir/bpf/sockops.c#L61-L63Replace
bpf_trace_printk
withbpf_printk
. The latter is a macro that ensures that the format string is allocated on the stack.