Skip to content

Commit d7485d5

Browse files
committed
elf_reader: add tests for ELF objects without BTF
Adds infrastructure to test loading of ELF objects compiled without BTF information. Fixes: #1810 Signed-off-by: Pavan More <pavansmore05@gmail.com>
1 parent 61c4efe commit d7485d5

13 files changed

+375
-272
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ TARGETS := \
4040
testdata/loader-clang-14 \
4141
testdata/loader-clang-17 \
4242
testdata/loader-$(CLANG) \
43+
testdata/loader-nobtf \
4344
testdata/manyprogs \
4445
testdata/btf_map_init \
4546
testdata/invalid_map \
@@ -119,6 +120,15 @@ testdata/loader-%-eb.elf: testdata/loader.c
119120
$(CLANG) $(CFLAGS) -target bpfeb -c $< -o $@
120121
$(STRIP) -g $@
121122

123+
# Build loader-nobtf: compile loader.c without BTF (-D__NOBTF__ -g0)
124+
NOBTF_CFLAGS := -O2 -g0 -Wall -Werror -mcpu=v2 -D__NOBTF__
125+
126+
testdata/loader-nobtf-el.elf: testdata/loader.c
127+
$(CLANG) $(NOBTF_CFLAGS) -target bpfel -c $< -o $@
128+
129+
testdata/loader-nobtf-eb.elf: testdata/loader.c
130+
$(CLANG) $(NOBTF_CFLAGS) -target bpfeb -c $< -o $@
131+
122132
.PHONY: update-external-deps
123133
update-external-deps:
124134
./scripts/update-kernel-deps.sh

0 commit comments

Comments
 (0)