From: Roger Pau Monne Date: Thu, 27 Jun 2019 09:33:33 +0000 (+0200) Subject: x86/linker: add a reloc section to ELF linker script X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1982 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=597c57becbeba21ff9f0c078ba2e32973d09d258;p=xen.git x86/linker: add a reloc section to ELF linker script if the hypervisor has been built with EFI support (ie: multiboot2). This allows to position the .reloc section correctly in the output binary. Note that for the ELF output format the .reloc section is moved before .bss because the data it contains is read-only, so it belongs with the other sections containing read-only data. Signed-off-by: Roger Pau Monné Acked-by: Jan Beulich Acked-by: Andrew Cooper --- diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 98a99444c2..cee7cf80dd 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -175,6 +175,19 @@ SECTIONS } :text #endif #endif + +/* + * ELF builds are linked to a fixed virtual address, and in principle + * shouldn't have a .reloc section. However, due to the way EFI support is + * currently implemented, retaining the .reloc section is necessary. + */ +#if defined(XEN_BUILD_EFI) && !defined(EFI) + . = ALIGN(4); + DECL_SECTION(.reloc) { + *(.reloc) + } :text +#endif + _erodata = .; . = ALIGN(SECTION_ALIGN);