From d1657d9d8663693db2ae90913e9e77ce719af849 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 22 Apr 2021 13:27:06 +0200 Subject: [PATCH] x86/EFI: program headers are an ELF concept MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit While they apparently do no harm when building xen.efi, their use is potentially misleading. Conditionalize their use to be for just the ELF binary we produce. No change to the resulting binaries. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- xen/arch/x86/xen.lds.S | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 0273f79152..3e29147b6a 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -34,13 +34,19 @@ OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT) OUTPUT_ARCH(i386:x86-64) +#ifndef EFI PHDRS { text PT_LOAD ; -#if (defined(BUILD_ID) || defined (CONFIG_PVH_GUEST)) && !defined(EFI) +#if defined(BUILD_ID) || defined(CONFIG_PVH_GUEST) note PT_NOTE ; #endif } +#define PHDR(x) :x +#else +#define PHDR(x) +#endif + SECTIONS { #if !defined(EFI) @@ -83,7 +89,7 @@ SECTIONS *(.text.kexec) *(.gnu.warning) _etext = .; /* End of text section */ - } :text = 0x9090 + } PHDR(text) = 0x9090 . = ALIGN(SECTION_ALIGN); __2M_text_end = .; @@ -134,12 +140,12 @@ SECTIONS *(SORT(.data.vpci.*)) __end_vpci_array = .; #endif - } :text + } PHDR(text) #if defined(CONFIG_PVH_GUEST) && !defined(EFI) DECL_SECTION(.note.Xen) { *(.note.Xen) - } :note :text + } PHDR(note) PHDR(text) #endif #if defined(BUILD_ID) @@ -154,13 +160,13 @@ SECTIONS __note_gnu_build_id_start = .; *(.note.gnu.build-id) __note_gnu_build_id_end = .; - } :note :text + } PHDR(note) PHDR(text) #elif defined(BUILD_ID_EFI) DECL_SECTION(.buildid) { __note_gnu_build_id_start = .; *(.buildid) __note_gnu_build_id_end = .; - } :text + } #endif #endif @@ -173,7 +179,7 @@ SECTIONS . = ALIGN(4); DECL_SECTION(.reloc) { *(.reloc) - } :text + } PHDR(text) #endif _erodata = .; @@ -202,7 +208,7 @@ SECTIONS #ifdef EFI /* EFI wants to merge all of .init.* ELF doesn't. */ . = ALIGN(SMP_CACHE_BYTES); #else - } :text + } PHDR(text) DECL_SECTION(.init.data) { #endif @@ -260,7 +266,7 @@ SECTIONS *(SORT(.data.vpci.*)) __end_vpci_array = .; #endif - } :text + } PHDR(text) . = ALIGN(SECTION_ALIGN); __init_end = .; @@ -281,7 +287,7 @@ SECTIONS *(.data.paramhypfs) __paramhypfs_end = .; #endif - } :text + } PHDR(text) DECL_SECTION(.data) { *(.data.page_aligned) @@ -289,7 +295,7 @@ SECTIONS *(.data.rel) *(.data.rel.*) CONSTRUCTORS - } :text + } PHDR(text) DECL_SECTION(.bss) { __bss_start = .; @@ -306,7 +312,7 @@ SECTIONS *(.bss) . = ALIGN(POINTER_ALIGN); __bss_end = .; - } :text + } PHDR(text) _end = . ; . = ALIGN(SECTION_ALIGN); @@ -316,12 +322,12 @@ SECTIONS . = ALIGN(4); DECL_SECTION(.reloc) { *(.reloc) - } :text + } /* Trick the linker into setting the image size to exactly 16Mb. */ . = ALIGN(__section_alignment__); DECL_SECTION(.pad) { . = ALIGN(MB(16)); - } :text + } #endif #ifndef XEN_BUILD_EFI -- 2.30.2