]> xenbits.xensource.com Git - xen.git/commitdiff
x86: explicitly mark __initdata variables as used when building with clang.
authorTim Deegan <tim@xen.org>
Wed, 11 Apr 2012 12:10:33 +0000 (13:10 +0100)
committerTim Deegan <tim@xen.org>
Wed, 11 Apr 2012 12:10:33 +0000 (13:10 +0100)
This stops LLVM from replacing it with a different, auto-generated
variable as part of an optimization.  (The auto-generated variable
ends up in the normal data section.)

Remove stray __read_mostly annotations on declarations that this unmasked.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/oprofile/op_x86_model.h
xen/include/acpi/cpufreq/cpufreq.h
xen/include/xen/compiler.h

index 87beedbf87a4c2fd2caa1c998af324a85f7fdc76..31d473b7f671501c5961dddab2c32b142c946440 100644 (file)
@@ -53,6 +53,6 @@ extern struct op_x86_model_spec const op_amd_fam15h_spec;
 void arch_perfmon_setup_counters(void);
 
 extern int ppro_has_global_ctrl;
-extern struct op_x86_model_spec const *__read_mostly model;
+extern struct op_x86_model_spec const *model;
 
 #endif /* OP_X86_MODEL_H */
index 3377232ccd84e82d9df4c87b326fb8d94154edfe..1798b9bb196f603fba73fc3dfe0775565fb6f536 100644 (file)
@@ -22,7 +22,7 @@
 
 DECLARE_PER_CPU(spinlock_t, cpufreq_statistic_lock);
 
-extern bool_t __read_mostly cpufreq_verbose;
+extern bool_t cpufreq_verbose;
 
 struct cpufreq_governor;
 
index 04f84ec393e0481143dc5217fac73e86167f87c1..8c26756afa5a2f5d8e30ae9cd10ac7afd0ee5e9e 100644 (file)
 #define always_inline __inline__ __attribute__ ((always_inline))
 #define noinline      __attribute__((noinline))
 
+#ifdef __clang__
+/* Clang can replace some vars with new automatic ones that go in .data;
+ * mark all explicit-segment vars 'used' to prevent that. */
+#define __section(s)      __attribute_used__ __attribute__((__section__(s)))
+#else
 #define __section(s)      __attribute__((__section__(s)))
+#endif
 #define __used_section(s) __attribute_used__ __attribute__((__section__(s)))
 #define __text_section(s) __attribute__((__section__(s)))