[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v3 06/25] tools/fuzz/x86_instruction_emulator: rework makefile


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 11 Jul 2022 16:08:55 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Sj9oFkingfdtvKPcRBxSTLyW6PnodPV3R8KwLJ0PWeA=; b=CUHWLTxAYaXVyLxu3yPAep03LiRaPT+i8nEhxlZOEio/gFN9rf2i7/YDI4W8GWetY8r9QmZWR9bDtFqCnLo8nQvsnRgSUraMGczUA2VGlsBj5BQuzPA/Sh8IXDe4BjWwF/GNxdaWHya7ITPdrW/ZqTbzBa243kNI6EmOJzKcJ9jcf7Td3Z5BTx8sfM7IhHGrrHXZeLRUdV0zjMiTQqYECzMzRWlVIUvSf2NQYMgyvPhvnm8iXuRHYtzLDP0GAMsWeU/yrlDcLFfwikYcRkfnXZVSDuTZwfNtyTswvqxZuwxzJ/ZknIFXp1PLSwy8SEDZS9xdSPp4cuihGfRA0DsTKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T52cG7fu2tQeZdAXimk5K275jLyaF6WcXgm4ImqUKS9OoiUYsk1qNm4AEs+5EKW8aDk6lUveXvBcFwyOW7IPRaKTc05GFCtcWecrcrkbM0WzpEe0uNUAx8gub9W6xFy+yM0fnx3f0OtN5YAv3dsjyCq6qCMfgajukjF/rPcPC37v65ppE9wcUwlQXRMzGBaUIFu/RYvRE3fPVNfrhQWgfrxF4ZWyuxxqCj7FDMXyYIuhxOwQ8aMPEEEzu6iJ5HIjUom8KiikKTQQjZAuXpq7BNBBaVJivV6Tsrsk3qvrcuWTr6rbLOUv+mk6fomiRoYX4sGyKIC5U29iiOTKC/rQcQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 11 Jul 2022 14:09:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24.06.2022 18:04, Anthony PERARD wrote:
> --- a/tools/fuzz/x86_instruction_emulator/Makefile
> +++ b/tools/fuzz/x86_instruction_emulator/Makefile
> @@ -8,33 +8,27 @@ else
>  x86-insn-fuzz-all:
>  endif
>  
> -# Add libx86 to the build
> -vpath %.c $(XEN_ROOT)/xen/lib/x86
> +cpuid.c: %: $(XEN_ROOT)/xen/lib/x86/% FORCE
> +     ln -nsf $< $@

I guess the idea with the original construct was to allow using further
source files from libx86 with as little code churn as possible. Your
change now requires two more lines to be touched. As long as we avoid
name collisions in the various directories (wrapper.c and a few more
files come from yet somewhere else), couldn't this rule simply be

%.c: $(XEN_ROOT)/xen/lib/x86/%.c FORCE
        ln -nsf $< $@

?

> -x86_emulate:
> -     [ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@
> +x86_emulate: FORCE
> +     ln -nsf $(XEN_ROOT)/xen/arch/x86/$@
>  
>  x86_emulate/%: x86_emulate ;
>  
> -x86-emulate.c x86-emulate.h wrappers.c: %:
> -     [ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
> +x86-emulate.c x86-emulate.h wrappers.c: %: 
> $(XEN_ROOT)/tools/tests/x86_emulator/% FORCE
> +     ln -nsf $< $@

And similarly

%.c: $(XEN_ROOT)/tools/tests/x86_emulator/%.c FORCE
        ln -nsf $< $@

%.h: $(XEN_ROOT)/tools/tests/x86_emulator/%.h FORCE
        ln -nsf $< $@

here? (I'm hesitant to suggest plain %, i.e. without the filename
suffixes, as that would likely be at least confusing for Makefile.)

> @@ -67,3 +61,5 @@ afl: afl-harness
>  
>  .PHONY: afl-cov
>  afl-cov: afl-harness-cov
> +
> +-include $(DEPS_INCLUDE)

I would expect doing so was avoided for some reason. Albeit it may
well be that too much cloning of tests/x86_emulator was done here,
and it's all fine this way. Can you confirm things to work when
building locally in just this subdir, e.g. via

make -sC .../tools/fuzz/x86_instruction_emulator 
CC=/build/afl/2.52b-base/afl-gcc

?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.