]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/alt: Fix build when CONFIG_LIVEPATCH is disabled
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 29 Aug 2018 10:55:32 +0000 (11:55 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 29 Aug 2018 13:28:48 +0000 (14:28 +0100)
c/s b28cd21c3628 "x86/build: Use new .nops directive when available"
introduced a __read_mostly boolean which is included if the toolchain supports
the .nops directive.

When CONFIG_LIVEPATCH is compiled out, alternative.o is expected to be a fully
init module, and toolchain_nops_are_ideal trips the build system check:

  Error: size of alternative.o:.data.read_mostly is 0x01
  /local/xen.git/xen/Rules.mk:206: recipe for target 'alternative.init.o' failed
  make[3]: *** [alternative.init.o] Error 12

Introduce init_or_livepatch_read_mostly and switch the annotation for
toolchain_nops_are_ideal.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/arch/x86/alternative.c
xen/include/xen/livepatch.h

index ea835d98a386e43e1b5605549377706b2f74a541..1ae49239d8afe2c025f4e034bd29c466aaa9099e 100644 (file)
@@ -91,7 +91,7 @@ asm ( ".pushsection .init.rodata, \"a\", @progbits\n\t"
       "toolchain_nops: .nops " __stringify(ASM_NOP_MAX) "\n\t"
       ".popsection\n\t");
 extern char toolchain_nops[ASM_NOP_MAX];
-static bool __read_mostly toolchain_nops_are_ideal;
+static bool init_or_livepatch_read_mostly toolchain_nops_are_ideal;
 
 #else
 # define toolchain_nops_are_ideal false
index 98ec01216bc3634a82f029b177011b0cc8fbfcf5..1b1817ca0dde3a95c89e12b2504886aa0cf8fab8 100644 (file)
@@ -23,6 +23,7 @@ struct xen_sysctl_livepatch_op;
 #define init_or_livepatch_const
 #define init_or_livepatch_constrel
 #define init_or_livepatch_data
+#define init_or_livepatch_read_mostly __read_mostly
 #define init_or_livepatch
 
 /* Convenience define for printk. */
@@ -121,6 +122,7 @@ void arch_livepatch_unmask(void);
 #define init_or_livepatch_const       __initconst
 #define init_or_livepatch_constrel    __initconstrel
 #define init_or_livepatch_data        __initdata
+#define init_or_livepatch_read_mostly __initdata
 #define init_or_livepatch             __init
 
 static inline int livepatch_op(struct xen_sysctl_livepatch_op *op)