diff mbox series

x86/shadow: fix build without PV or HVM

Message ID 20210427104003.28075-1-roger.pau@citrix.com (mailing list archive)
State New
Headers show
Series x86/shadow: fix build without PV or HVM | expand

Commit Message

Roger Pau Monné April 27, 2021, 10:40 a.m. UTC
When trying to build an hypervisor without PV or HVM (ie: using
automation/configs/x86/no_hvm_pv_config) it fails to link with:

prelink.o: In function `sh_remove_write_access_from_sl1p':
arch/x86/mm/shadow/common.c:(.text+0x72b4c): undefined reference to `sh_rm_write_access_from_sl1p__guest_4'
arch/x86/mm/shadow/common.c:(.text+0x72b4c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_rm_write_access_from_sl1p__guest_4'
prelink.o: In function `sh_remove_shadow_via_pointer':
arch/x86/mm/shadow/common.c:(.text+0x72bfa): undefined reference to `sh_clear_shadow_entry__guest_4'
arch/x86/mm/shadow/common.c:(.text+0x72bfa): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_clear_shadow_entry__guest_4'
prelink.o: In function `_sh_resync':
arch/x86/mm/shadow/common.c:(.text+0x72e4a): undefined reference to `sh_resync_l1__guest_4'
arch/x86/mm/shadow/common.c:(.text+0x72e4a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_resync_l1__guest_4'
prelink.o: In function `shadow_vcpu_init':
(.text+0x72eeb): undefined reference to `sh_paging_mode__guest_4'
prelink.o: In function `shadow_vcpu_init':
(.text+0x72eeb): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_paging_mode__guest_4'
prelink.o: In function `sh_resync_all':
(.text+0x73315): undefined reference to `sh_safe_not_to_sync__guest_4'
prelink.o: In function `sh_resync_all':
(.text+0x73315): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_safe_not_to_sync__guest_4'
prelink.o: In function `sh_resync_all':
(.text+0x7336a): undefined reference to `sh_resync_l1__guest_4'
prelink.o: In function `sh_resync_all':
(.text+0x7336a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_resync_l1__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x736bd): undefined reference to `sh_map_and_validate_gl4e__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x736bd): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_map_and_validate_gl4e__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x736dd): undefined reference to `sh_map_and_validate_gl1e__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x736dd): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_map_and_validate_gl1e__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x736fd): undefined reference to `sh_map_and_validate_gl2e__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x736fd): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_map_and_validate_gl2e__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x7371d): undefined reference to `sh_map_and_validate_gl2he__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x7371d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_map_and_validate_gl2he__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x7373d): undefined reference to `sh_map_and_validate_gl3e__guest_4'
prelink.o: In function `sh_validate_guest_entry':
(.text+0x7373d): additional relocation overflows omitted from the output
prelink.o: In function `shadow_unhook_mappings':
(.text+0x7379b): undefined reference to `sh_unhook_64b_mappings__guest_4'
prelink.o: In function `sh_destroy_shadow':
(.text+0x74183): undefined reference to `sh_destroy_l1_shadow__guest_4'
prelink.o: In function `sh_destroy_shadow':
(.text+0x74199): undefined reference to `sh_destroy_l4_shadow__guest_4'
prelink.o: In function `sh_destroy_shadow':
(.text+0x741a1): undefined reference to `sh_destroy_l3_shadow__guest_4'
prelink.o: In function `sh_destroy_shadow':
(.text+0x741a9): undefined reference to `sh_destroy_l2_shadow__guest_4'
prelink.o:(.data.rel.ro.local+0x1018): undefined reference to `sh_remove_l1_shadow__guest_4'
prelink.o:(.data.rel.ro.local+0x1020): undefined reference to `sh_remove_l1_shadow__guest_4'
prelink.o:(.data.rel.ro.local+0x1028): undefined reference to `sh_remove_l2_shadow__guest_4'
prelink.o:(.data.rel.ro.local+0x1030): undefined reference to `sh_remove_l3_shadow__guest_4'
prelink.o:(.data.rel.ro.local+0x1068): undefined reference to `sh_rm_mappings_from_l1__guest_4'
prelink.o:(.data.rel.ro.local+0x1070): undefined reference to `sh_rm_mappings_from_l1__guest_4'
ld: /root/src/xen/xen/.xen-syms.0: hidden symbol `sh_destroy_l2_shadow__guest_4' isn't defined
ld: final link failed: Bad value

Fix this by making shadow depend on either PV or HVM being selected in
Kconfig.

Fixes: aff8bf94ce6 ('x86/shadow: only 4-level guest code needs building when !HVM')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Roger Pau Monné April 27, 2021, 10:49 a.m. UTC | #1
On Tue, Apr 27, 2021 at 12:40:03PM +0200, Roger Pau Monne wrote:
> When trying to build an hypervisor without PV or HVM (ie: using
> automation/configs/x86/no_hvm_pv_config) it fails to link with:
> 
> prelink.o: In function `sh_remove_write_access_from_sl1p':
> arch/x86/mm/shadow/common.c:(.text+0x72b4c): undefined reference to `sh_rm_write_access_from_sl1p__guest_4'
> arch/x86/mm/shadow/common.c:(.text+0x72b4c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_rm_write_access_from_sl1p__guest_4'
> prelink.o: In function `sh_remove_shadow_via_pointer':
> arch/x86/mm/shadow/common.c:(.text+0x72bfa): undefined reference to `sh_clear_shadow_entry__guest_4'
> arch/x86/mm/shadow/common.c:(.text+0x72bfa): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_clear_shadow_entry__guest_4'
> prelink.o: In function `_sh_resync':
> arch/x86/mm/shadow/common.c:(.text+0x72e4a): undefined reference to `sh_resync_l1__guest_4'
> arch/x86/mm/shadow/common.c:(.text+0x72e4a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_resync_l1__guest_4'
> prelink.o: In function `shadow_vcpu_init':
> (.text+0x72eeb): undefined reference to `sh_paging_mode__guest_4'
> prelink.o: In function `shadow_vcpu_init':
> (.text+0x72eeb): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_paging_mode__guest_4'
> prelink.o: In function `sh_resync_all':
> (.text+0x73315): undefined reference to `sh_safe_not_to_sync__guest_4'
> prelink.o: In function `sh_resync_all':
> (.text+0x73315): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_safe_not_to_sync__guest_4'
> prelink.o: In function `sh_resync_all':
> (.text+0x7336a): undefined reference to `sh_resync_l1__guest_4'
> prelink.o: In function `sh_resync_all':
> (.text+0x7336a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_resync_l1__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x736bd): undefined reference to `sh_map_and_validate_gl4e__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x736bd): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_map_and_validate_gl4e__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x736dd): undefined reference to `sh_map_and_validate_gl1e__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x736dd): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_map_and_validate_gl1e__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x736fd): undefined reference to `sh_map_and_validate_gl2e__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x736fd): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_map_and_validate_gl2e__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x7371d): undefined reference to `sh_map_and_validate_gl2he__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x7371d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sh_map_and_validate_gl2he__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x7373d): undefined reference to `sh_map_and_validate_gl3e__guest_4'
> prelink.o: In function `sh_validate_guest_entry':
> (.text+0x7373d): additional relocation overflows omitted from the output
> prelink.o: In function `shadow_unhook_mappings':
> (.text+0x7379b): undefined reference to `sh_unhook_64b_mappings__guest_4'
> prelink.o: In function `sh_destroy_shadow':
> (.text+0x74183): undefined reference to `sh_destroy_l1_shadow__guest_4'
> prelink.o: In function `sh_destroy_shadow':
> (.text+0x74199): undefined reference to `sh_destroy_l4_shadow__guest_4'
> prelink.o: In function `sh_destroy_shadow':
> (.text+0x741a1): undefined reference to `sh_destroy_l3_shadow__guest_4'
> prelink.o: In function `sh_destroy_shadow':
> (.text+0x741a9): undefined reference to `sh_destroy_l2_shadow__guest_4'
> prelink.o:(.data.rel.ro.local+0x1018): undefined reference to `sh_remove_l1_shadow__guest_4'
> prelink.o:(.data.rel.ro.local+0x1020): undefined reference to `sh_remove_l1_shadow__guest_4'
> prelink.o:(.data.rel.ro.local+0x1028): undefined reference to `sh_remove_l2_shadow__guest_4'
> prelink.o:(.data.rel.ro.local+0x1030): undefined reference to `sh_remove_l3_shadow__guest_4'
> prelink.o:(.data.rel.ro.local+0x1068): undefined reference to `sh_rm_mappings_from_l1__guest_4'
> prelink.o:(.data.rel.ro.local+0x1070): undefined reference to `sh_rm_mappings_from_l1__guest_4'
> ld: /root/src/xen/xen/.xen-syms.0: hidden symbol `sh_destroy_l2_shadow__guest_4' isn't defined
> ld: final link failed: Bad value
> 
> Fix this by making shadow depend on either PV or HVM being selected in
> Kconfig.
> 
> Fixes: aff8bf94ce6 ('x86/shadow: only 4-level guest code needs building when !HVM')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Urg, I see this has already been fixed. Not sure why my rebase didn't
clear the patch.

Sorry for the noise.
diff mbox series

Patch

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 32b9f23a20e..966b3634591 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -121,6 +121,7 @@  config XEN_SHSTK
 
 config SHADOW_PAGING
 	bool "Shadow Paging"
+	depends on PV || HVM
 	default !PV_SHIM_EXCLUSIVE
 	depends on PV || HVM
 	---help---