]> xenbits.xensource.com Git - xen.git/commitdiff
coverage: fix on ARM
authorIan Campbell <ian.campbell@citrix.com>
Fri, 22 Feb 2013 10:57:40 +0000 (10:57 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 12 Mar 2013 15:46:50 +0000 (15:46 +0000)
Use a list of pointers to simplify the handling of 32- vs 64-bit.

Also on ARM the section name is ".init_array" and not ".ctors".

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
[ ijc -- tweak whitespace per Frediano's comment ]

xen/arch/arm/xen.lds.S
xen/arch/x86/xen.lds.S
xen/common/lib.c

index 90439940fbf4b4e6f264c2617023f975e7924bf3..fd755d7437ffea4ad50ab16df19668ac33c47be0 100644 (file)
@@ -91,12 +91,10 @@ SECTIONS
        *(.init.data.rel)
        *(.init.data.rel.*)
 
-       . = ALIGN(4);
-       __CTOR_LIST__ = .;
-       LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
-       *(.ctors)
-       LONG(0)
-       __CTOR_END__ = .;
+       . = ALIGN(8);
+       __ctors_start = .;
+       *(.init_array)
+       __ctors_end = .;
   } :text
   . = ALIGN(32);
   .init.setup : {
index 55703896e35007ddc1653cceae99fab45b7592a4..d959941d36ff328ef13352a5f856499c13e85cc0 100644 (file)
@@ -110,11 +110,9 @@ SECTIONS
        __trampoline_seg_stop = .;
 
        . = ALIGN(8);
-       __CTOR_LIST__ = .;
-       QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
+       __ctors_start = .;
        *(.ctors)
-       QUAD(0)
-       __CTOR_END__ = .;
+       __ctors_end = .;
   } :text
   . = ALIGN(32);
   .init.setup : {
index e0c65cfec3d6b72842abc6c451bf59b6c3029418..e3cb3f4730ef00fd5f7de6b8083979c7579e3a62 100644 (file)
@@ -479,17 +479,14 @@ 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__;
+typedef void (*ctor_func_t)(void);
+extern const ctor_func_t __ctors_start[], __ctors_end[];
 
 void __init init_constructors(void)
 {
-    unsigned long n;
-    for ( n = 0; n < __CTOR_LIST__.count; ++n )
-        __CTOR_LIST__.funcs[n]();
+    const ctor_func_t *f;
+    for ( f = __ctors_start; f < __ctors_end; ++f )
+        (*f)();
 }
 
 /*