diff options
author | Tim Deegan <tim@xen.org> | 2012-04-11 13:10:33 +0100 |
---|---|---|
committer | Tim Deegan <tim@xen.org> | 2012-04-11 13:10:33 +0100 |
commit | 2b7aac76417d57e336f41b6f6d5b0cb301d512f8 (patch) | |
tree | 91b0a6128dd8cf4e4f673cb91321032371641109 | |
parent | 899b4c43f687dd577d90b0a875676868b8eaa835 (diff) | |
download | xen-2b7aac76417d57e336f41b6f6d5b0cb301d512f8.tar.gz xen-2b7aac76417d57e336f41b6f6d5b0cb301d512f8.tar.bz2 xen-2b7aac76417d57e336f41b6f6d5b0cb301d512f8.zip |
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@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
-rw-r--r-- | xen/include/asm-arm/cache.h | 2 | ||||
-rw-r--r-- | xen/include/asm-arm/percpu.h | 2 | ||||
-rw-r--r-- | xen/include/asm-x86/cache.h | 2 | ||||
-rw-r--r-- | xen/include/asm-x86/percpu.h | 2 | ||||
-rw-r--r-- | xen/include/xen/compiler.h | 4 | ||||
-rw-r--r-- | xen/include/xen/init.h | 23 | ||||
-rw-r--r-- | xen/include/xen/spinlock.h | 4 | ||||
-rw-r--r-- | xen/include/xsm/xsm.h | 2 |
8 files changed, 19 insertions, 22 deletions
diff --git a/xen/include/asm-arm/cache.h b/xen/include/asm-arm/cache.h index 41b62910e7..9f331784c5 100644 --- a/xen/include/asm-arm/cache.h +++ b/xen/include/asm-arm/cache.h @@ -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 --git a/xen/include/asm-arm/percpu.h b/xen/include/asm-arm/percpu.h index 1c1f6159ad..ab27292167 100644 --- a/xen/include/asm-arm/percpu.h +++ b/xen/include/asm-arm/percpu.h @@ -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 --git a/xen/include/asm-x86/cache.h b/xen/include/asm-x86/cache.h index f5667a14fa..f4a08e786f 100644 --- a/xen/include/asm-x86/cache.h +++ b/xen/include/asm-x86/cache.h @@ -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 --git a/xen/include/asm-x86/percpu.h b/xen/include/asm-x86/percpu.h index e6faa8ce07..604ff0d7b0 100644 --- a/xen/include/asm-x86/percpu.h +++ b/xen/include/asm-x86/percpu.h @@ -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 --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index ec26dded6e..04f84ec393 100644 --- a/xen/include/xen/compiler.h +++ b/xen/include/xen/compiler.h @@ -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 --git a/xen/include/xen/init.h b/xen/include/xen/init.h index f7a7dc4d9d..995bbac445 100644 --- a/xen/include/xen/init.h +++ b/xen/include/xen/init.h @@ -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 --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index 2df4452709..8133fe0934 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -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 --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index f081d5b788..bef79df8cd 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -44,7 +44,7 @@ extern xsm_initcall_t __xsm_initcall_start[], __xsm_initcall_end[]; #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, |