[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/4] Use weak symbol to avoid bad trick in Makefiles
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@xxxxxxxxxx> --- 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |