xen/build: put image header into a separate section
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 9 Mar 2022 12:28:45 +0000 (13:28 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 10 Mar 2022 18:47:55 +0000 (18:47 +0000)
So it can be explicitly placed ahead of the rest of the .text content
in the linker script (and thus the resulting image). This is a
prerequisite for further work that will add a catch-all to the text
section (.text.*).

Note that placement of the sections inside of .text is also slightly
adjusted to be more similar to the position found in the default GNU
ld linker script.

The special handling of the object file containing the header data as
the first object file passed to the linker command line can also be
removed.

While there also remove the special handling of efi/ on x86. There's
no need for the resulting object file to be passed in any special
order to the linker.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/arch.mk
xen/arch/arm/arm32/Makefile
xen/arch/arm/arm32/head.S
xen/arch/arm/arm64/Makefile
xen/arch/arm/arm64/head.S
xen/arch/arm/xen.lds.S
xen/arch/x86/Makefile
xen/arch/x86/arch.mk
xen/arch/x86/boot/head.S
xen/arch/x86/xen.lds.S

index 094b67072304767cfa8ace0f66604b031b5fc622..58db76c4e172e869c830ac9a7a6db78eceb3b81f 100644 (file)
@@ -23,5 +23,3 @@ ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
         LDFLAGS += --fix-cortex-a53-843419
     endif
 endif
-
-ALL_OBJS-y := arch/arm/$(TARGET_SUBARCH)/head.o $(ALL_OBJS-y)
index 3040eabce3ad246bce4476e5fda38debf3be92c8..520fb420542c8ecf51de1a22f2edf020ae663e24 100644 (file)
@@ -4,11 +4,10 @@ obj-$(CONFIG_EARLY_PRINTK) += debug.o
 obj-y += domctl.o
 obj-y += domain.o
 obj-y += entry.o
+obj-y += head.o
 obj-y += insn.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o
 obj-y += proc-v7.o proc-caxx.o
 obj-y += smpboot.o
 obj-y += traps.o
 obj-y += vfp.o
-
-extra-y += head.o
index 7a906167efca8790db0b58c6aaec7a77af92242a..c837d3054cf95cc045e1a3d68e1c4dd6f609e7e7 100644 (file)
 
 #endif /* !CONFIG_EARLY_PRINTK */
 
+        .section .text.header, "ax", %progbits
         .arm
 
         /*
index baa87655fad03258496c32ce95066821d36413af..6d507da0d44d3de8b1477e7b1972c49eb0a4186c 100644 (file)
@@ -7,6 +7,7 @@ obj-$(CONFIG_EARLY_PRINTK) += debug.o
 obj-y += domctl.o
 obj-y += domain.o
 obj-y += entry.o
+obj-y += head.o
 obj-y += insn.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o
 obj-y += smc.o
@@ -14,5 +15,3 @@ obj-y += smpboot.o
 obj-y += traps.o
 obj-y += vfp.o
 obj-y += vsysreg.o
-
-extra-y += head.o
index 66d862fc813741faaf7b97fe1a967752da170374..e62c48ec1cdb9793fb7af86202b9bee8b186e1b1 100644 (file)
         add \xb, \xb, x20
 .endm
 
+        .section .text.header, "ax", %progbits
         /*.aarch64*/
 
         /*
index 08016948ab3139f923327f7884dd09dd56fd3853..743455a5f9fe92a898163ba46de4a542dc666ef3 100644 (file)
@@ -30,9 +30,13 @@ SECTIONS
   _start = .;
   .text : {
         _stext = .;            /* Text section */
-       *(.text)
+       *(.text.header)
+
        *(.text.cold)
-       *(.text.unlikely)
+       *(.text.unlikely .text.*_unlikely .text.unlikely.*)
+
+       *(.text)
+
        *(.fixup)
        *(.gnu.warning)
        _etext = .;             /* End of text section */
index 9c40e0b4d7e45e47a4aa11047125e2807baf775b..04065a73106f6b276262f01c19a1966c353fedac 100644 (file)
@@ -1,5 +1,7 @@
 obj-y += acpi/
+obj-y += boot/
 obj-y += cpu/
+obj-y += efi/
 obj-y += genapic/
 obj-$(CONFIG_GUEST) += guest/
 obj-$(CONFIG_HVM) += hvm/
@@ -77,9 +79,6 @@ obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o
 obj-y += sysctl.o
 endif
 
-# Allows "clean" to descend into boot/
-subdir- += boot
-
 extra-y += asm-macros.i
 extra-y += xen.lds
 
index 8e57476d65739b6a4149b2526b981d86d2184cfc..c90e56aeab87c7c78fb999ee9c7faecf08bb3140 100644 (file)
@@ -117,5 +117,3 @@ endif
 
 # Set up the assembler include path properly for older toolchains.
 CFLAGS += -Wa,-I$(srctree)/include
-
-ALL_OBJS-y := arch/x86/boot/built_in.o arch/x86/efi/built_in.o $(ALL_OBJS-y)
index dd1bea0d10b3e813595204dc701ffec5a22b75d5..92d73345f0c9f0e1c9f72857471aae689b02d351 100644 (file)
@@ -9,7 +9,7 @@
 #include <asm/cpufeature.h>
 #include <public/elfnote.h>
 
-        .text
+        .section .text.header, "ax", @progbits
         .code32
 
 #define sym_offs(sym)     ((sym) - __XEN_VIRT_START)
index 506bc8e4042adf9e70f4e3d9f99e2b07391170ed..960c51eb4cad594171d3a13806a9682a7a34722f 100644 (file)
@@ -73,9 +73,7 @@ SECTIONS
   _start = .;
   DECL_SECTION(.text) {
         _stext = .;            /* Text and read-only data */
-       *(.text)
-       *(.text.__x86_indirect_thunk_*)
-       *(.text.page_aligned)
+       *(.text.header)
 
        . = ALIGN(PAGE_SIZE);
        _stextentry = .;
@@ -87,7 +85,12 @@ SECTIONS
        kexec_reloc_end = .;
 
        *(.text.cold)
-       *(.text.unlikely)
+       *(.text.unlikely .text.*_unlikely .text.unlikely.*)
+
+       *(.text)
+       *(.text.__x86_indirect_thunk_*)
+       *(.text.page_aligned)
+
        *(.fixup)
        *(.gnu.warning)
        _etext = .;             /* End of text section */