From patchwork Thu Mar 30 15:39:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Schmoll X-Patchwork-Id: 9654677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7033460113 for ; Thu, 30 Mar 2017 15:43:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6248E285B0 for ; Thu, 30 Mar 2017 15:43:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56F42285B9; Thu, 30 Mar 2017 15:43:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C0DC9285B8 for ; Thu, 30 Mar 2017 15:43:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctcBq-0004gM-PL; Thu, 30 Mar 2017 15:40:46 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctcBp-0004gG-T6 for xen-devel@lists.xenproject.org; Thu, 30 Mar 2017 15:40:46 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id FE/BE-03705-DF62DD85; Thu, 30 Mar 2017 15:40:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsVyMbThsO4ftbs RBid/KFl83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlvp7xiK7gqWrHv2xmWBsbfgl2MXBxCAjMZ JX6tX84G4rAIvGSRmHH5PAuIIyHQzypx4fQLIIcTyImRWHV8BiuEXSGxZdZ0NhBbSEBT4kt3F yOEvZxJ4t3yYhCbTcBAYvbKi8wgtoiAksS9VZOZQGxmAReJrnnNYL3CAkYSBxZ1gM1nEVCV6P l6DKyGV8BOYuKlaVB75SV2tV0E28spYC8x48YRJohddhLLLz9nmsAosICRYRWjRnFqUVlqka6 hoV5SUWZ6RkluYmaOrqGBsV5uanFxYnpqTmJSsV5yfu4mRmBoMQDBDsbVv50OMUpyMCmJ8roL 3Y0Q4kvKT6nMSCzOiC8qzUktPsQow8GhJMErAAxVIcGi1PTUirTMHGCQw6QlOHiURHi1QNK8x QWJucWZ6RCpU4zGHA9O7XrDxPGp//AbJiGWvPy8VClxXj6QUgGQ0ozSPLhBsOi7xCgrJczLCH SaEE9BalFuZgmq/CtGcQ5GJWFeC5ApPJl5JXD7XgGdwgR0irjNLZBTShIRUlINjBZxeZyrUzs 2T5hzcG8zd2phB2v7Sc/l+yQj3z7K+fBvy3Xh0soSrZgDUeXGH1avV3d7G/kuaYbYJ48n+bwK Xflpy7z/Pbq67Xvxrt0bvK/vk95nuXNfRqVZwsdSo8QXZ3++Lmg4FBx4K0/9vJjjnkyDhJpnc heddH9Nv9l2/1l/rm1uZcG9CiWW4oxEQy3mouJEAJnABzG5AgAA X-Env-Sender: eggi.innovations@gmail.com X-Msg-Ref: server-13.tower-31.messagelabs.com!1490888444!92349325!1 X-Originating-IP: [209.85.128.195] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7672 invoked from network); 30 Mar 2017 15:40:44 -0000 Received: from mail-wr0-f195.google.com (HELO mail-wr0-f195.google.com) (209.85.128.195) by server-13.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 30 Mar 2017 15:40:44 -0000 Received: by mail-wr0-f195.google.com with SMTP id u18so13228480wrc.0 for ; Thu, 30 Mar 2017 08:40:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SAjv/P6Gufak1EGWAo9BvlLKQQ3w9pDjbBguxkLPARo=; b=MJzUUjX/6PGhhhqFGMX7eY0RyGIuhyFciGcaH5ngr08ZBXHOICOGNVwyRGfEa2HifT STmKM6NWlVPWlmCtHvpekG+/wKLtG95dOxEDmvjSjbOOOy1coFyOuVsH1cAh+yOkSAiK v3u/TGHa7iWSvAMNWMYVrAP6X27+V+Bjd4zm7CYMVcj4MmjMnDkKajQf7HgHUKNZh0hY yVliw3PSGRfp1MZxmMVDBZRmXbnN0Fkd3qt0nM0Dq1ZHXN0lAhopsMP74ilmf+okecL/ uPCsFCCaZtICxBoIijHD5AbQpJTvI7SU/S5FI2T2o5p/IH2Ipzsb9BE9lJsBmbUMB/bL F9/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SAjv/P6Gufak1EGWAo9BvlLKQQ3w9pDjbBguxkLPARo=; b=NMwkahQ0LVagTA7ZtmcWc3f9nG1hYca2lhgaPEZAc5NEJWheOw1nUyMaLNnRJo6RIb eSNn9zaDbuBxE0ZbtM5B0m7kGB4tulCn2zMQzpoHzrwO/RBfnjVGlhuUndnknJ/ASdGV qtt1OuLlbdu3PlJ03SV85XFjQvCtAMtwof6Wgs9wNKA53og4ZLjCIk5CQkuWspnREI/S 8hUu1t+ZXZZGeuT2sHZUcsFEBuEy0X3daY9PEdDeCBlUPgTmZvirvVE8rILI1NBtLZus TN6CXepC5euLAorawWGK0BfpdtOGJe2jFeyJ2cAUy6jl0Nj0Gb/kch1H8FMMb9H0l6N7 35lw== X-Gm-Message-State: AFeK/H0g4e42+BSOw5BLfGdnQroj2KfXK4/6Mqt9EZ6blmahzcTovfEph7FLDwE3czEGeA== X-Received: by 10.28.184.87 with SMTP id i84mr980218wmf.129.1490888443983; Thu, 30 Mar 2017 08:40:43 -0700 (PDT) Received: from debian.jacobs-university.de (firewallix.jacobs-university.de. [212.201.44.247]) by smtp.gmail.com with ESMTPSA id g41sm3207753wrg.53.2017.03.30.08.40.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 08:40:43 -0700 (PDT) From: Felix Schmoll To: xen-devel@lists.xenproject.org Date: Thu, 30 Mar 2017 17:39:56 +0200 Message-Id: <20170330153956.1822-1-eggi.innovations@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170329181602.1107-1-eggi.innovations@gmail.com> References: <20170329181602.1107-1-eggi.innovations@gmail.com> Cc: wei.liu2@citrix.com, Felix Schmoll Subject: [Xen-devel] [PATCH] Enable compiling with gcc tracing X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Make minimal adjustments in order to enable the compilation of the xen source-code with gcc-6's -fsanitize-coverage=trace-pc option. Due to a bug in Xen's build-system the flag for the compiler has to be handed in via the command line, i.e. for compiling one would use: make CC= This is an experimental patch as in a final version you would not want all files to be compiled with this option by default. Signed-off-by: Felix Schmoll --- xen/Rules.mk | 9 ++++++++- xen/include/xen/hypercall.h | 1 + xen/include/xen/my_tracer.h | 6 ++++++ xen/my_tracer.c | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 xen/include/xen/my_tracer.h create mode 100644 xen/my_tracer.c diff --git a/xen/Rules.mk b/xen/Rules.mk index 77bcd44922..14de50d540 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -33,7 +33,9 @@ override TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \ TARGET := $(BASEDIR)/xen + # Note that link order matters! +ALL_OBJS-y += $(BASEDIR)/my_tracer.o ALL_OBJS-y += $(BASEDIR)/common/built_in.o ALL_OBJS-y += $(BASEDIR)/drivers/built_in.o ALL_OBJS-y += $(BASEDIR)/xsm/built_in.o @@ -46,6 +48,7 @@ else CFLAGS += -O2 -fomit-frame-pointer endif +CFLAGS += -fsanitize-coverage=trace-pc CFLAGS += -nostdinc -fno-builtin -fno-common CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h @@ -171,7 +174,11 @@ _clean_%/: FORCE $(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean %.o: %.c Makefile - $(CC) $(CFLAGS) -c $< -o $@ + if [ $@ != $(BASEDIR)/my_tracer.o ]; \ + then $(CC) $(CFLAGS) -c $< -o $@; \ + else \ + $(CC) -include $(BASEDIR)/include/xen/my_tracer.h -c $(BASEDIR)/my_tracer.c -o $(BASEDIR)/my_tracer.o; \ + fi %.o: %.S Makefile $(CC) $(AFLAGS) -c $< -o $@ diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index cc99aea57d..ec19e1c80f 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -5,6 +5,7 @@ #ifndef __XEN_HYPERCALL_H__ #define __XEN_HYPERCALL_H__ +#include #include #include #include diff --git a/xen/include/xen/my_tracer.h b/xen/include/xen/my_tracer.h new file mode 100644 index 0000000000..7081e60f34 --- /dev/null +++ b/xen/include/xen/my_tracer.h @@ -0,0 +1,6 @@ +#ifndef _TRACE_H_ +#define _TRACE_H_ + +void __sanitizer_cov_trace_pc(void); + +#endif diff --git a/xen/my_tracer.c b/xen/my_tracer.c new file mode 100644 index 0000000000..2a2f8053f8 --- /dev/null +++ b/xen/my_tracer.c @@ -0,0 +1 @@ +void __sanitizer_cov_trace_pc(void) { return; }