From patchwork Mon Dec 6 17:02:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 12659021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80B0CC433EF for ; Mon, 6 Dec 2021 17:08:17 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.239502.415298 (Exim 4.92) (envelope-from ) id 1muHTA-0006TS-Jt; Mon, 06 Dec 2021 17:08:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 239502.415298; Mon, 06 Dec 2021 17:08:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muHTA-0006SP-B8; Mon, 06 Dec 2021 17:08:04 +0000 Received: by outflank-mailman (input) for mailman id 239502; Mon, 06 Dec 2021 17:08:02 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muHP5-0005ta-6k for xen-devel@lists.xenproject.org; Mon, 06 Dec 2021 17:03:51 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7a879e1f-56b6-11ec-a5e1-b9374ead2679; Mon, 06 Dec 2021 18:03:49 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7a879e1f-56b6-11ec-a5e1-b9374ead2679 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1638810229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BHKgdcCFIcw2aiewzH6pZ1uVlVigf4URrqTZQIJcZwI=; b=aWAlpeRPquChvIDdxnpX6wHzzAIuOAEFMGyzOUu1kshr98uix1niOO02 55uxkwsBg3xRDiVDXqp2nIIKi2U76ClZ4lWm0xk44Ejxdsa5104jU/pNJ aalJ27VffPoTTKSKKCGfT4i4vU8i4IhyQ3jmmfwWpS8x2eZLOPfuYkvJ9 Q=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: awMe2UEYGgJ6YVSNJTcx4uOQBPZtcMozEo6Gb0XSc5/gjJpI/J1x5WSIwh5RKy0Sst6+qLRvHY +kvYfuB/0MtGUz2UzWeeoaJSPcFPAM6+dV82njyVa/NqTe0mV2aiTfMhqadskkpyaY6mSgk2VB qsXkg38jpOkufAuoZeWpSIJh9IYqG1RIsol4Db+vogdA9jzn2r5aqrglEFYLgcLcOH1HccN5x6 BF5SsHhzI6K9Yh3I5cXWZ7XQ0PT2n9/Oilfr1yT4gl7EArt4aoZPK0LYMuB44+tE6dUIgptUGn 25SxMsOVel72n0dmof0BCmui X-SBRS: 5.1 X-MesageID: 59324094 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:o7nY7azFhEaYtWPCfgh6t+eswSrEfRIJ4+MujC+fZmUNrF6WrkVSy WYeDD+BO6mNNzHwe95yPN+y/RhX6JfWm9FmGlNrpCAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAuLeNYYH1500s6wbZn2tQAbeWRWGthh /uj+6UzB3f9s9JEGjp8B3Wr8U4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2gTeSJsFZgJjEMeJN67/kwLv5SAQyLBoQk/FAthPY0GwooJkHDP8060sKMYWJBSdmjbDj 1SKAQ0VrPXmqpMu9IWbnriNqoqkSrMsHkdTE2TBw6yxMC3WojiqzYNaCb7adjHBTmLkvq6lY LwNnf37NfQGmndMspZ9TOk3nf5vuYO3quYDnAp+HXjNY1C6MZ9aIyGLjZtVq6lA5r5Fog/qC EiBzcZXZOeSM8T/HV9PeAd8Nraf1esZkyX55OguJBmo/zd++beKXBkAPxSIjyABfrJ5PJl8n LUksc8SrQe+lgArIpCNiSUNrzaAKXkJUqMGsJAGAdC01lp3mw8aOZGMWDXr5JyvaslXNhh4K zCZs6POmrBAyxeQaHE0D3XMgbJQiJlmVMqmF7Pey4BlQub4u8I= IronPort-HdrOrdr: A9a23:N+xA662ldZKWd4fSpzOQyQqjBLQkLtp133Aq2lEZdPRUGvb2qy nIpoV96faUskdpZJhOo7G90cW7LE80sKQFg7X5Xo3SODUO2lHJEGgK1+KLqFfd8m/Fh4tgPM 9bAs5D4bbLY2SS4/yX3ODBKadC/OW6 X-IronPort-AV: E=Sophos;i="5.87,292,1631592000"; d="scan'208";a="59324094" From: Anthony PERARD To: CC: Anthony PERARD , Anthony PERARD , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , "Stefano Stabellini" , Wei Liu Subject: [XEN PATCH 27/57] tools/fuzz/libelf: rework makefile Date: Mon, 6 Dec 2021 17:02:10 +0000 Message-ID: <20211206170241.13165-28-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211206170241.13165-1-anthony.perard@citrix.com> References: <20211206170241.13165-1-anthony.perard@citrix.com> MIME-Version: 1.0 Rename ELF_LIB_OBJS to LIBELF_OBJS as to have the same name as in libs/guest/. Replace "-I" by "-iquote". Remove the use of "vpath". It will not works when we will convert this makefile to subdirmk. Instead, we create symlinks to the source files. Signed-off-by: Anthony PERARD --- .gitignore | 1 + tools/fuzz/libelf/Makefile | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index c31fa9b841..4267bb4dee 100644 --- a/.gitignore +++ b/.gitignore @@ -197,6 +197,7 @@ tools/flask/utils/flask-setenforce tools/flask/utils/flask-set-bool tools/flask/utils/flask-label-pci tools/fuzz/libelf/afl-libelf-fuzzer +tools/fuzz/libelf/libelf-*.c tools/fuzz/x86_instruction_emulator/asm tools/fuzz/x86_instruction_emulator/afl-harness tools/fuzz/x86_instruction_emulator/afl-harness-cov diff --git a/tools/fuzz/libelf/Makefile b/tools/fuzz/libelf/Makefile index 9eb30ee40c..9211f75951 100644 --- a/tools/fuzz/libelf/Makefile +++ b/tools/fuzz/libelf/Makefile @@ -1,25 +1,24 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk -# libelf fuzz target -vpath %.c ../../../xen/common/libelf -CFLAGS += -I../../../xen/common/libelf -ELF_SRCS-y += libelf-tools.c libelf-loader.c libelf-dominfo.c -ELF_LIB_OBJS := $(patsubst %.c,%.o,$(ELF_SRCS-y)) +LIBELF_OBJS := libelf-tools.o libelf-loader.o libelf-dominfo.o -$(patsubst %.c,%.o,$(ELF_SRCS-y)): CFLAGS += -Wno-pointer-sign - -$(ELF_LIB_OBJS): CFLAGS += -DFUZZ_NO_LIBXC $(CFLAGS_xeninclude) +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.a: libelf-fuzzer.o $(ELF_LIB_OBJS) +$(LIBELF_OBJS:.o=.c): libelf-%.c: ../../../xen/common/libelf/libelf-%.c FORCE + ln -nsf $< $@ + +libelf.a: libelf-fuzzer.o $(LIBELF_OBJS) $(AR) rc $@ $^ .PHONY: libelf-fuzzer-all libelf-fuzzer-all: libelf.a libelf-fuzzer.o -afl-libelf-fuzzer: afl-libelf-fuzzer.o libelf-fuzzer.o $(ELF_LIB_OBJS) +afl-libelf-fuzzer: afl-libelf-fuzzer.o libelf-fuzzer.o $(LIBELF_OBJS) $(CC) $(CFLAGS) $^ -o $@ # Common targets @@ -31,7 +30,7 @@ distclean: clean .PHONY: clean clean: - rm -f *.o .*.d *.a *-libelf-fuzzer + rm -f *.o .*.d *.a *-libelf-fuzzer $(LIBELF_OBJS:.o=.c) .PHONY: install install: all