xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Frediano Ziglio <frediano.ziglio@citrix.com>
To: frediano.ziglio@citrix.com,
	Konrad Rzeszutek Wilk <konrad@kernel.org>,
	"Keir (Xen.org)" <keir@xen.org>,
	Ian Campbell <Ian.Campbell@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>, xen-devel@lists.xen.org
Subject: [PATCH 4/4] Use weak symbol to avoid bad trick in Makefiles
Date: Fri, 1 Feb 2013 14:48:23 +0000	[thread overview]
Message-ID: <1359730103-9474-5-git-send-email-frediano.ziglio@citrix.com> (raw)
In-Reply-To: <1359730103-9474-1-git-send-email-frediano.ziglio@citrix.com>

Define do_coverage_op to point to do_ni_hypercall as weak symbol.
This allow the linked to redirect coverage operations to void function if
coverage are not enabled.
This save some space and compression bytes if coverage is disabled.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
---
 xen/common/Makefile        |    2 +-
 xen/common/compat/kernel.c |    1 +
 xen/common/gcov/Makefile   |    5 +----
 xen/common/gcov/nogcov.c   |   22 ----------------------
 xen/common/kernel.c        |    4 ++++
 5 files changed, 7 insertions(+), 27 deletions(-)
 delete mode 100644 xen/common/gcov/nogcov.c

diff --git a/xen/common/Makefile b/xen/common/Makefile
index 51191d6..8a0c506 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -59,7 +59,7 @@ subdir-$(CONFIG_COMPAT) += compat
 
 subdir-$(x86_64) += hvm
 
-subdir-y += gcov
+subdir-$(coverage) += gcov
 
 subdir-y += libelf
 subdir-$(HAS_DEVICE_TREE) += libfdt
diff --git a/xen/common/compat/kernel.c b/xen/common/compat/kernel.c
index a2a2751..564c2a1 100644
--- a/xen/common/compat/kernel.c
+++ b/xen/common/compat/kernel.c
@@ -42,6 +42,7 @@ CHECK_TYPE(domain_handle);
 #define xennmi_callback_t compat_nmi_callback_t
 
 #define DO(fn) int compat_##fn
+#define NAME(fn) "compat_" #fn
 #define COMPAT
 
 #include "../kernel.c"
diff --git a/xen/common/gcov/Makefile b/xen/common/gcov/Makefile
index 43a692c..c9efe6c 100644
--- a/xen/common/gcov/Makefile
+++ b/xen/common/gcov/Makefile
@@ -1,5 +1,2 @@
-ifneq ($(coverage),y)
-obj-y += nogcov.o
-endif
-obj-$(coverage) += gcov.o
+obj-y += gcov.o
 
diff --git a/xen/common/gcov/nogcov.c b/xen/common/gcov/nogcov.c
deleted file mode 100644
index 9642c96..0000000
--- a/xen/common/gcov/nogcov.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * nogov.c
- *
- * Compiled if coverage information are not enabled
- */
-
-#include <xen/config.h>
-#include <xen/lib.h>
-#include <xen/errno.h>
-#include <public/xen.h>
-
-long do_coverage_op(int op, XEN_GUEST_HANDLE_PARAM(void) uarg)
-{
-    return -ENOSYS;
-}
-
-#ifdef CONFIG_COMPAT
-int compat_coverage_op(int op, XEN_GUEST_HANDLE_PARAM(void) uarg)
-    __attribute__ ((alias ("do_coverage_op")));
-#endif
-
-
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 55caff6..25ba667 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -197,6 +197,7 @@ void __init do_initcalls(void)
 }
 
 # define DO(fn) long do_##fn
+# define NAME(fn) "do_" #fn
 
 #endif
 
@@ -367,6 +368,9 @@ DO(ni_hypercall)(void)
     return -ENOSYS;
 }
 
+DO(coverage_op)(int op, XEN_GUEST_HANDLE_PARAM(void) uarg)
+    __attribute__ ((weak, alias(NAME(ni_hypercall))));
+
 /*
  * Local variables:
  * mode: C
-- 
1.7.9.5

  parent reply	other threads:[~2013-02-01 14:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01 14:48 [RFC PATCH] Coverage support Frediano Ziglio
2013-02-01 14:48 ` [PATCH 1/4] Reserve hypercall number for handling coverage informations Frediano Ziglio
2013-02-01 14:48 ` [PATCH 2/4] Adding support for coverage information Frediano Ziglio
2013-02-04  9:39   ` Jan Beulich
2013-02-04 15:29     ` Frediano Ziglio
2013-02-04 15:44       ` Jan Beulich
2013-02-01 14:48 ` [PATCH 3/4] Implement code to read coverage informations Frediano Ziglio
2013-02-01 14:48 ` Frediano Ziglio [this message]
2013-02-01 15:46 ` [RFC PATCH] Coverage support Frediano Ziglio
2013-02-04 12:54   ` Ian Campbell
2013-02-04  9:27 ` Jan Beulich
2013-02-04 14:56   ` Frediano Ziglio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359730103-9474-5-git-send-email-frediano.ziglio@citrix.com \
    --to=frediano.ziglio@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=keir@xen.org \
    --cc=konrad@kernel.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).