x86/pv: Fix Clang build with !CONFIG_PV32
PATCH 1/1 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 evaluation of this_cpu(compat_gdt) to within the guarded region.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
--- xen/arch/x86/cpu/common.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
xen/arch/x86/cpu/common.c +3 -4
@@ -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);
Signature · 1 line
2.11.0
Quoted 10 lines · Andrew Cooper
Clang 3.5 doesn't do enough dead-code-elimination to drop the
compat_gdtreference, resulting in a linker failure:hidden symbol `per_cpu__compat_gdt' isn't defined
Drop the local variable, and move evaluation of
this_cpu(compat_gdt)to within the guarded region.Reported-by Roger Pau Monné <[email protected]>Signed-off-by Andrew Cooper <[email protected]>
Thanks!
xen/arch/x86/cpu/common.c void load_system_tables(void) · line 756
Quoted 9 lines · Andrew Cooper
xen/arch/x86/cpu/common.c +3
-2@@ -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);
Isn't indentation here off by 4 compared to what we normally do with extremely large argument expressions? Other than this lgtm.
Jan
Quoted 14 lines · Jan Beulich
[CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments unless you have verified the sender and know the content is safe.
xen/arch/x86/cpu/common.c void load_system_tables(void) · line 756
Quoted 9 lines · Andrew Cooper
xen/arch/x86/cpu/common.c +3
-2@@ -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);Isn't indentation here off by 4 compared to what we normally do with extremely large argument expressions?
No. This is Linux style (therefore 8-space tabs), not Xen style (4 spaces).
~Andrew
Quoted 16 lines · Andrew Cooper
Quoted 14 lines · Jan Beulich
[CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments unless you have verified the sender and know the content is safe.
xen/arch/x86/cpu/common.c void load_system_tables(void) · line 756
Quoted 9 lines · Andrew Cooper
xen/arch/x86/cpu/common.c +3
-2@@ -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);Isn't indentation here off by 4 compared to what we normally do with extremely large argument expressions?
Quoted 1 line
No. This is Linux style (therefore 8-space tabs), not Xen style (4 spaces).
Oh, right - din't pay attention at all to this being tabs, sorry.
Jan