[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xen: define __section() and friends and use them for section annotations.



# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1334146233 -3600
# Node ID 6c604c0c3525d85b279738e72c8b2c61cc12c35b
# Parent  1d8fb1330f98d3eae982c2540c8a2acab7f00009
xen: define __section() and friends and use them for section annotations.

By itself this is just code-tidying, but it's also useful for the
following patch, which will adjust __section() for clang compiles.

Signed-off-by: Tim Deegan <tim@xxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---


diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-arm/cache.h
--- a/xen/include/asm-arm/cache.h       Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-arm/cache.h       Wed Apr 11 13:10:33 2012 +0100
@@ -7,7 +7,7 @@
 #define L1_CACHE_SHIFT  (CONFIG_ARM_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __read_mostly __section(".data.read_mostly")
 
 #endif
 /*
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-arm/percpu.h
--- a/xen/include/asm-arm/percpu.h      Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-arm/percpu.h      Wed Apr 11 13:10:33 2012 +0100
@@ -8,7 +8,7 @@ void percpu_init_areas(void);
 
 /* Separate out the type, so (int[3], foo) works. */
 #define __DEFINE_PER_CPU(type, name, suffix)                    \
-    __attribute__((__section__(".bss.percpu" #suffix)))         \
+    __section(".bss.percpu" #suffix)                            \
     __typeof__(type) per_cpu_##name
 
 
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-x86/cache.h
--- a/xen/include/asm-x86/cache.h       Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-x86/cache.h       Wed Apr 11 13:10:33 2012 +0100
@@ -10,6 +10,6 @@
 #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __read_mostly __section(".data.read_mostly")
 
 #endif
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-x86/percpu.h
--- a/xen/include/asm-x86/percpu.h      Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-x86/percpu.h      Wed Apr 11 13:10:33 2012 +0100
@@ -9,7 +9,7 @@ void percpu_init_areas(void);
 
 /* Separate out the type, so (int[3], foo) works. */
 #define __DEFINE_PER_CPU(type, name, suffix)                    \
-    __attribute__((__section__(".bss.percpu" #suffix)))         \
+    __section(".bss.percpu" #suffix)                            \
     __typeof__(type) per_cpu_##name
 
 /* var is in discarded region: offset to particular copy we want */
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h        Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/compiler.h        Wed Apr 11 13:10:33 2012 +0100
@@ -14,6 +14,10 @@
 #define always_inline __inline__ __attribute__ ((always_inline))
 #define noinline      __attribute__((noinline))
 
+#define __section(s)      __attribute__((__section__(s)))
+#define __used_section(s) __attribute_used__ __attribute__((__section__(s)))
+#define __text_section(s) __attribute__((__section__(s)))
+
 #ifdef INIT_SECTIONS_ONLY
 /*
  * For sources indicated to have only init code, make sure even
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/init.h
--- a/xen/include/xen/init.h    Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/init.h    Wed Apr 11 13:10:33 2012 +0100
@@ -7,20 +7,13 @@
  * Mark functions and data as being only used at initialization
  * or exit time.
  */
-#define __init       \
-    __attribute__ ((__section__ (".init.text")))
-#define __exit       \
-    __attribute_used__ __attribute__ ((__section__(".exit.text")))
-#define __initdata   \
-    __attribute__ ((__section__ (".init.data")))
-#define __exitdata   \
-    __attribute_used__ __attribute__ ((__section__ (".exit.data")))
-#define __initsetup  \
-    __attribute_used__ __attribute__ ((__section__ (".init.setup")))
-#define __init_call(lvl)  \
-    __attribute_used__ __attribute__ ((__section__ (".initcall" lvl ".init")))
-#define __exit_call  \
-    __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+#define __init            __text_section(".init.text")
+#define __exit            __text_section(".exit.text")
+#define __initdata        __section(".init.data")
+#define __exitdata        __used_section(".exit.data")
+#define __initsetup       __used_section(".init.setup")
+#define __init_call(lvl)  __used_section(".initcall" lvl ".init")
+#define __exit_call       __used_section(".exitcall.exit")
 
 /* These macros are used to mark some functions or 
  * initialized data (doesn't apply to uninitialized data)
@@ -95,7 +88,7 @@ struct kernel_param {
 extern struct kernel_param __setup_start, __setup_end;
 
 #define __setup_str static __initdata __attribute__((__aligned__(1))) char
-#define __kparam static __attribute_used__ __initsetup struct kernel_param
+#define __kparam static __initsetup struct kernel_param
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/spinlock.h
--- a/xen/include/xen/spinlock.h        Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/spinlock.h        Wed Apr 11 13:10:33 2012 +0100
@@ -77,8 +77,8 @@ struct lock_profile_qhead {
 
 #define _LOCK_PROFILE(name) { 0, #name, &name, 0, 0, 0, 0, 0 }
 #define _LOCK_PROFILE_PTR(name)                                               \
-    static struct lock_profile *__lock_profile_##name __attribute_used__      \
-    __attribute__ ((__section__(".lockprofile.data"))) =                      \
+    static struct lock_profile *__lock_profile_##name                         \
+    __used_section(".lockprofile.data") =                                     \
     &__lock_profile_data_##name
 #define _SPIN_LOCK_UNLOCKED(x) { _RAW_SPIN_LOCK_UNLOCKED, 0xfffu, 0,          \
                                  _LOCK_DEBUG, x }
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h     Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xsm/xsm.h     Wed Apr 11 13:10:33 2012 +0100
@@ -44,7 +44,7 @@ extern xsm_initcall_t __xsm_initcall_sta
 
 #define xsm_initcall(fn) \
     static xsm_initcall_t __initcall_##fn \
-    __attribute_used__ __attribute__((__section__(".xsm_initcall.init"))) = fn
+    __used_section(".xsm_initcall.init") = fn
 
 struct xsm_operations {
     void (*security_domaininfo) (struct domain *d,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.