Skip to content

Commit

Permalink
Use extern objects for the eBPF test framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy committed Apr 30, 2024
1 parent cec9561 commit 782f630
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion backends/ebpf/runtime/runtime.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ BPFOBJ=
BPFNAME=$(basename $(BPFOBJ))
BPFDIR=$(dir $(BPFOBJ))
override INCLUDES+= -I$(dir $(BPFOBJ))
# This can be any file with the extension ".c"
EXTERNOBJ=

# Arguments for the P4 Compiler
P4INCLUDE=-I./p4include
Expand All @@ -31,7 +33,7 @@ SOURCE_BASE= $(ROOT_DIR)ebpf_runtime.c $(ROOT_DIR)pcap_util.c
SOURCE_BASE+= $(ROOT_DIR)ebpf_runtime_$(TARGET).c
# Add the generated file and externs to the base sources
override SOURCES+= $(SOURCE_BASE)
SRC_PROCESSED= $(notdir $(SOURCES))
SRC_PROCESSED= $(notdir $(SOURCES)) $(EXTERNOBJ)
OBJECTS = $(SRC_PROCESSED:%.c=$(BUILDDIR)/%.o)
DEPS = $(OBJECTS:%.o=%.d)

Expand Down
5 changes: 1 addition & 4 deletions backends/ebpf/targets/test_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ def compile_dataplane(self):
# include the src of libbpf directly, does not require installation
args += f"INCLUDES+=-I{self.runtimedir}/contrib/libbpf/src "
if self.options.extern:
# we inline the extern so we need a direct include
args += f"INCLUDES+=-include{self.options.extern} "
# need to include the temporary dir because of the tmp import
args += f"INCLUDES+=-I{self.tmpdir} "
args += f"EXTERNOBJ+={self.options.extern} "
result = testutils.exec_process(args)
if result.returncode != testutils.SUCCESS:
testutils.log.error("Failed to build the filter")
Expand Down

0 comments on commit 782f630

Please sign in to comment.