Get ex2 running

This commit is contained in:
2025-09-07 19:19:58 +05:30
parent 734a49b295
commit c0559639f2
11 changed files with 72 additions and 35 deletions

View File

@ -1,19 +1,19 @@
BPF_CLANG := clang
CFLAGS := -O2 -emit-llvm -target bpf -c
SRC := ex3.bpf.c
OUT := ex3.bpf.ll
OBJECT := ex3.bpf.o
SRC := $(wildcard *.bpf.c)
LL := $(SRC:.bpf.c=.bpf.ll)
OBJ := $(SRC:.bpf.c=.bpf.o)
.PHONY: all clean
all: $(OUT)
object: $(SRC)
$(BPF_CLANG) -O2 -g -target bpf -c $< -o $(OBJECT)
all: $(LL) $(OBJ)
$(OUT): $(SRC) object
%.bpf.o: %.bpf.c
$(BPF_CLANG) -O2 -target bpf -c $< -o $@
%.bpf.ll: %.bpf.c
$(BPF_CLANG) $(CFLAGS) -S $< -o $@
clean:
rm -f $(OUT) $(OBJECT)
rm -f $(LL) $(OBJ)

View File

@ -1,7 +1,7 @@
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
SEC("kprobe/sys_clone")
SEC("tracepoint/syscalls/sys_enter_execve")
int hello(struct pt_regs *ctx) {
bpf_printk("Hello, World!\n");
return 0;