It's not quite clear why for libelf and the emulator we use symlink-ing,
while elsewhere we use vpath. Do so for these two as well, thus also
eliminating the need for custom -iquote options and custom cleaning.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Of course for the emulator fuzzer we could go farther and use vpath also
for the references into the test harness dir as well as the core emulator
one.
--- a/tools/fuzz/libelf/Makefile
+++ b/tools/fuzz/libelf/Makefile
@@ -1,17 +1,15 @@
XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
+vpath %.c $(XEN_ROOT)/xen/common/libelf
+
LIBELF_OBJS := libelf-tools.o libelf-loader.o libelf-dominfo.o
-CFLAGS += -iquote ../../../xen/common/libelf
$(LIBELF_OBJS): CFLAGS += -Wno-pointer-sign
$(LIBELF_OBJS): CFLAGS += -DFUZZ_NO_LIBXC $(CFLAGS_xeninclude)
libelf-fuzzer.o: CFLAGS += $(CFLAGS_xeninclude)
-$(LIBELF_OBJS:.o=.c): libelf-%.c: ../../../xen/common/libelf/libelf-%.c FORCE
- ln -nsf $< $@
-
libelf.a: libelf-fuzzer.o $(LIBELF_OBJS)
$(AR) rc $@ $^
@@ -30,7 +28,7 @@ distclean: clean
.PHONY: clean
clean:
- rm -f *.o .*.d *.a *-libelf-fuzzer $(LIBELF_OBJS:.o=.c)
+ rm -f *.o .*.d *.a *-libelf-fuzzer
.PHONY: install
install: all
--- a/tools/fuzz/x86_instruction_emulator/Makefile
+++ b/tools/fuzz/x86_instruction_emulator/Makefile
@@ -9,8 +9,7 @@ x86-insn-fuzz-all:
endif
# Add libx86 to the build
-%.c: $(XEN_ROOT)/xen/lib/x86/%.c FORCE
- ln -nsf $< $@
+vpath %.c $(XEN_ROOT)/xen/lib/x86
x86_emulate: FORCE
mkdir -p $@
@@ -25,7 +24,6 @@ x86_emulate/%.h: x86_emulate ;
ln -nsf $< $@
CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -iquote .
-cpuid.o: CFLAGS += -iquote $(XEN_ROOT)/xen/lib/x86
GCOV_FLAGS := --coverage
%-cov.o: %.c
@@ -72,7 +70,7 @@ distclean: clean
clean:
rm -f *.a *.o $(DEPS_RM) *.gcda *.gcno *.gcov
rm -f afl-harness afl-harness-cov libfuzzer-harness
- rm -rf x86_emulate x86-emulate.c x86-emulate.h wrappers.c cpuid.c
+ rm -rf x86_emulate x86-emulate.c x86-emulate.h wrappers.c
.PHONY: install
install: all
On 16/12/2025 3:34 pm, Jan Beulich wrote: > It's not quite clear why for libelf and the emulator we use symlink-ing, > while elsewhere we use vpath. Do so for these two as well, thus also > eliminating the need for custom -iquote options and custom cleaning. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> > --- > Of course for the emulator fuzzer we could go farther and use vpath also > for the references into the test harness dir as well as the core emulator > one. Doing everything consistently sounds like a good thing.
© 2016 - 2025 Red Hat, Inc.