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

[Xen-devel] [PATCH 6 of 7 v2] xen: define __section() and friends and use them for section annotations


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Tim Deegan <tim@xxxxxxx>
  • Date: Thu, 5 Apr 2012 16:51:55 +0100
  • Delivery-date: Thu, 05 Apr 2012 16:09:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1333640955 -3600
# Node ID fba1917c638768c0a4e45c507c29f1020e08dfc1
# Parent  0908535327a5b01e49b69cd96db464be21ff3ee6
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>

diff -r 0908535327a5 -r fba1917c6387 xen/include/asm-arm/cache.h
--- a/xen/include/asm-arm/cache.h       Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-arm/cache.h       Thu Apr 05 16:49:15 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 0908535327a5 -r fba1917c6387 xen/include/asm-arm/percpu.h
--- a/xen/include/asm-arm/percpu.h      Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-arm/percpu.h      Thu Apr 05 16:49:15 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 0908535327a5 -r fba1917c6387 xen/include/asm-x86/cache.h
--- a/xen/include/asm-x86/cache.h       Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-x86/cache.h       Thu Apr 05 16:49:15 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 0908535327a5 -r fba1917c6387 xen/include/asm-x86/percpu.h
--- a/xen/include/asm-x86/percpu.h      Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-x86/percpu.h      Thu Apr 05 16:49:15 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 0908535327a5 -r fba1917c6387 xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h        Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xen/compiler.h        Thu Apr 05 16:49:15 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 0908535327a5 -r fba1917c6387 xen/include/xen/init.h
--- a/xen/include/xen/init.h    Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xen/init.h    Thu Apr 05 16:49:15 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 0908535327a5 -r fba1917c6387 xen/include/xen/spinlock.h
--- a/xen/include/xen/spinlock.h        Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xen/spinlock.h        Thu Apr 05 16:49:15 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 0908535327a5 -r fba1917c6387 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h     Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xsm/xsm.h     Thu Apr 05 16:49:15 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-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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