From: Andrew Cooper Date: Sat, 5 Feb 2022 17:28:16 +0000 (+0000) Subject: build: Make head.S invariant to link order X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bc0abf2a5498d4691538bf34496ca0f0f189951b;p=people%2Fandrewcoop%2Fxen-test-framework.git build: Make head.S invariant to link order Introduce .text.head, ensure it is linked first, and use it in {hvm,pv}/head.S. This removes the need for head-$(env).o to be linked first, removing all head special casing in the build system. Signed-off-by: Andrew Cooper --- diff --git a/arch/x86/hvm/head.S b/arch/x86/hvm/head.S index a5c1150..cfe165e 100644 --- a/arch/x86/hvm/head.S +++ b/arch/x86/hvm/head.S @@ -7,6 +7,7 @@ #include + .section ".text.head", "ax", @progbits .code32 /* Always starts in 32bit flat mode. */ GLOBAL(_elf_start) /* HVM common setup. */ diff --git a/arch/x86/link.lds.S b/arch/x86/link.lds.S index 4daee1c..a7716d6 100644 --- a/arch/x86/link.lds.S +++ b/arch/x86/link.lds.S @@ -37,6 +37,7 @@ SECTIONS _start = .; .text : { + *(.text.head) *(.text) . = ALIGN(PAGE_SIZE); diff --git a/arch/x86/pv/head.S b/arch/x86/pv/head.S index 5ff8b8a..0b2592f 100644 --- a/arch/x86/pv/head.S +++ b/arch/x86/pv/head.S @@ -17,7 +17,7 @@ ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "!writable_page_tables|pae_pgdir_above_4gb") ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") - .text + .section ".text.head", "ax", @progbits __ASM_SEL(.code32, .code64) /* PV entry point. */ diff --git a/build/common.mk b/build/common.mk index 594952d..f81b2da 100644 --- a/build/common.mk +++ b/build/common.mk @@ -53,13 +53,12 @@ CFLAGS_$($(1)_arch) := $$(COMMON_CFLAGS) $$(COMMON_CFLAGS-$($(1)_arch)) AFLAGS_$(1) := $$(AFLAGS_$($(1)_arch)) $$(COMMON_AFLAGS-$(1)) -DCONFIG_ENV_$(1) -include arch/config.h CFLAGS_$(1) := $$(CFLAGS_$($(1)_arch)) $$(COMMON_CFLAGS-$(1)) -DCONFIG_ENV_$(1) -include arch/config.h -head-$(1) := $(ROOT)/arch/x86/$($(1)_guest)/head-$(1).o link-$(1) := $(ROOT)/arch/x86/link-$(1).lds LDFLAGS_$(1) := -T $$(link-$(1)) -nostdlib $(LDFLAGS-y) # Needs to pick up test-provided obj-perenv and obj-perarch -DEPS-$(1) = $$(head-$(1)) \ +DEPS-$(1) = \ $$(obj-perarch:%.o=%-$($(1)_arch).o) \ $$(obj-$(1):%.o=%-$(1).o) $$(obj-perenv:%.o=%-$(1).o) diff --git a/build/files.mk b/build/files.mk index 5c1cc8d..af31c65 100644 --- a/build/files.mk +++ b/build/files.mk @@ -31,6 +31,7 @@ obj-perenv += $(ROOT)/arch/x86/traps.o # HVM specific objects obj-hvm += $(ROOT)/arch/x86/apic.o obj-hvm += $(ROOT)/arch/x86/hpet.o +obj-hvm += $(ROOT)/arch/x86/hvm/head.o obj-hvm += $(ROOT)/arch/x86/hvm/pagetables.o obj-hvm += $(ROOT)/arch/x86/hvm/traps.o obj-hvm += $(ROOT)/arch/x86/io-apic.o @@ -43,6 +44,7 @@ $(foreach env,$(HVM_ENVIRONMENTS),$(eval obj-$(env) += $(obj-hvm))) # PV specific objects +obj-pv += $(ROOT)/arch/x86/pv/head.o obj-pv += $(ROOT)/arch/x86/pv/traps.o $(foreach env,$(PV_ENVIRONMENTS),$(eval obj-$(env) += $(obj-pv)))