From 762cc5db03ece3677bbc64faa084f88b540c8ae9 Mon Sep 17 00:00:00 2001 From: Sergiu Moga Date: Fri, 11 Aug 2023 15:45:13 +0300 Subject: [PATCH] plat/common/x86: Fix `libukreloc` error for non-`PIE` `SMP` builds After the merge of commit cf8cc65cb0ae ("plat/kvm/x86: Make SMP init code resolve its own `start16` relocations") SMP builds that were not built with `libukreloc` would fail due to external references to `x86_start16_*` symbols no longer being declared. Thus, fix this by making their declaration present regardless of `CONFIG_LIBUKRELOC` being enabled or not. Furthermore, guard the no longer necessary `START16_UKRELOC_*` macro's, as they are not needed if the previously mentioned configuration is not enabled. Signed-off-by: Sergiu Moga Reviewed-by: Marco Schlumpp Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #1037 --- plat/common/x86/lcpu.c | 2 -- plat/common/x86/start16_helpers.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plat/common/x86/lcpu.c b/plat/common/x86/lcpu.c index c593f2a7a..6be907b1a 100644 --- a/plat/common/x86/lcpu.c +++ b/plat/common/x86/lcpu.c @@ -51,9 +51,7 @@ #include #include -#if CONFIG_LIBUKRELOC #include "start16_helpers.h" -#endif /* CONFIG_LIBUKRELOC */ __lcpuid lcpu_arch_id(void) { diff --git a/plat/common/x86/start16_helpers.h b/plat/common/x86/start16_helpers.h index af801539d..067de8c1b 100644 --- a/plat/common/x86/start16_helpers.h +++ b/plat/common/x86/start16_helpers.h @@ -14,6 +14,7 @@ extern void *x86_start16_end[]; #define X86_START16_SIZE \ ((__uptr)x86_start16_end - (__uptr)x86_start16_begin) +#if CONFIG_LIBUKRELOC #define START16_UKRELOC_MOV_SYM(sym, sz) \ sym##_uk_reloc_imm##sz##_start16 @@ -36,5 +37,6 @@ extern void *x86_start16_end[]; UKRELOC_ENTRY(START16_UKRELOC_##type##_OFF(sym, sz), \ (void *)sym - (void *)x86_start16_begin, \ sz, UKRELOC_FLAGS_PHYS_REL) +#endif /* CONFIG_LIBUKRELOC */ #endif /* __START16_HELPERS_H__ */ -- 2.39.5