Skip to content

Commit

Permalink
src/Makefile: Fix h3xduck#41 and h3xduck#48 in compiling
Browse files Browse the repository at this point in the history
1. use `-fno-stack-protector` to remove `__stack_chk_fail` symbol
2. use `-L` to specify libbpf library paths

Signed-off-by: void0red <void0red@gmail.com>
  • Loading branch information
void0red committed Apr 7, 2024
1 parent d825d4c commit 49cac49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ $(OUTPUT)/%.o: $(USER)/%.c $(wildcard $(USER)/*.h)| $(OUTPUT)
$(Q)$(CC) $(CFLAGS) $(INCLUDES) $(COMMON_INCLUDES) -c $(filter $(USER)/%.c,$^) -Wno-deprecated-declarations -o $@ -ldl

# Build application binary
$(APPS): %: $(OUTPUT)/%.o $(LIBBPF_OBJ) $(USER_INCLUDES_OBJ) | $(OUTPUT)
$(APPS): %: $(OUTPUT)/%.o $(USER_INCLUDES_OBJ) | $(OUTPUT)
$(call msg,BINARY,$@)
$(Q)$(CC) $(CFLAGS) $(INCLUDES) $^ -lelf -lbpf -lz -lssl -lcrypto -Wno-deprecated-declarations -o bin/$@ -ldl
$(Q)$(CC) $(CFLAGS) $(INCLUDES) $^ -L$(OUTPUT) -lelf -lbpf -lz -lssl -lcrypto -Wno-deprecated-declarations -o bin/$@ -ldl
$(Q)rm $(USER_INCLUDES_OBJ)

# TC egress program
tckit: $(abspath $(EBPF)/include/bpf)/tc.c $(LIBBPF_OBJ)
clang -O2 -emit-llvm -g -c $(abspath $(EBPF)/include/bpf)/tc.c -o - | \
clang -O2 -emit-llvm -g -fno-stack-protector -c $(abspath $(EBPF)/include/bpf)/tc.c -o - | \
llc -march=bpf -mcpu=probe -filetype=obj -o bin/tc.o


Expand Down

0 comments on commit 49cac49

Please sign in to comment.