From: Andrew Cooper Date: Tue, 5 May 2020 13:03:35 +0000 (+0100) Subject: x86/pv: Fix Clang build with !CONFIG_PV32 X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~306 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cdc3b1f26f80b57b28fb94cb4bf26f79a3cc2765;p=xen.git x86/pv: Fix Clang build with !CONFIG_PV32 Clang 3.5 doesn't do enough dead-code-elimination to drop the compat_gdt reference, resulting in a linker failure: hidden symbol `per_cpu__compat_gdt' isn't defined Drop the local variable, and move the evaluation of this_cpu(compat_gdt) to within the guarded region. Reported-by: Roger Pau Monné Signed-off-by: Andrew Cooper Tested-by: Roger Pau Monné Reviewed-by: Roger Pau Monné --- diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 131ff03fcf..63f3893c7a 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -711,8 +711,6 @@ void load_system_tables(void) struct tss64 *tss = &this_cpu(tss_page).tss; seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY; - seg_desc_t *compat_gdt = - this_cpu(compat_gdt) - FIRST_RESERVED_GDT_ENTRY; const struct desc_ptr gdtr = { .base = (unsigned long)gdt, @@ -753,8 +751,9 @@ void load_system_tables(void) _set_tssldt_desc(gdt + TSS_ENTRY, (unsigned long)tss, sizeof(*tss) - 1, SYS_DESC_tss_avail); if ( IS_ENABLED(CONFIG_PV32) ) - _set_tssldt_desc(compat_gdt + TSS_ENTRY, (unsigned long)tss, - sizeof(*tss) - 1, SYS_DESC_tss_busy); + _set_tssldt_desc( + this_cpu(compat_gdt) - FIRST_RESERVED_GDT_ENTRY + TSS_ENTRY, + (unsigned long)tss, sizeof(*tss) - 1, SYS_DESC_tss_busy); per_cpu(full_gdt_loaded, cpu) = false; lgdt(&gdtr);