aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/lib.c
diff options
context:
space:
mode:
authorFrediano Ziglio <frediano.ziglio@citrix.com>2013-02-14 12:37:13 +0000
committerKeir <keir.xen@gmail.com>2013-02-21 16:15:33 +0000
commit68ca0bc4ba2f70d50b4c5eecbba53ce113bd8ad6 (patch)
tree977daad21d116d101b477a903f6e19e53cf14a1a /xen/common/lib.c
parent82639998a5f2afce55990c387dfdf06e032803e6 (diff)
downloadxen-68ca0bc4ba2f70d50b4c5eecbba53ce113bd8ad6.tar.gz
xen-68ca0bc4ba2f70d50b4c5eecbba53ce113bd8ad6.tar.bz2
xen-68ca0bc4ba2f70d50b4c5eecbba53ce113bd8ad6.zip
gcov: Call constructors during initialization
This allow modules to set initializer functions. This is used by Gcc instrumentation code for profiling arcs and test coverage.
Diffstat (limited to 'xen/common/lib.c')
-rw-r--r--xen/common/lib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/xen/common/lib.c b/xen/common/lib.c
index 018345ebbd..e0c65cfec3 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -2,6 +2,7 @@
#include <xen/ctype.h>
#include <xen/lib.h>
#include <xen/types.h>
+#include <xen/init.h>
#include <asm/byteorder.h>
/* for ctype.h */
@@ -478,6 +479,19 @@ unsigned long long parse_size_and_unit(const char *s, const char **ps)
return ret;
}
+extern const struct
+{
+ unsigned long count;
+ void (*funcs[1])(void);
+} __CTOR_LIST__;
+
+void __init init_constructors(void)
+{
+ unsigned long n;
+ for ( n = 0; n < __CTOR_LIST__.count; ++n )
+ __CTOR_LIST__.funcs[n]();
+}
+
/*
* Local variables:
* mode: C