Backport upstream fixes to correctly build Xen using LLVM 8 toolchain. Note the fixes are not strictly needed for xen-tools since the Xen shim build is only ever supposed to be booted using the PVH entry point (and not the multiboot entry points). Yet given LLD8 erratic behaviour with orphan section placement I think it's best to ensure proper section placement for the shim also. Sponsored by: Citrix Systems R&D Reviewed by: mat Differential revision: https://reviews.freebsd.org/D20816
51 lines
1.5 KiB
Diff
51 lines
1.5 KiB
Diff
From 597c57becbeba21ff9f0c078ba2e32973d09d258 Mon Sep 17 00:00:00 2001
|
|
From: Roger Pau Monne <roger.pau@citrix.com>
|
|
Date: Thu, 27 Jun 2019 11:33:33 +0200
|
|
Subject: [PATCH 1/4] x86/linker: add a reloc section to ELF linker script
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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é <roger.pau@citrix.com>
|
|
Acked-by: Jan Beulich <jbeulich@suse.com>
|
|
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
|
|
---
|
|
xen/arch/x86/xen.lds.S | 13 +++++++++++++
|
|
1 file changed, 13 insertions(+)
|
|
|
|
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);
|
|
--
|
|
2.20.1 (Apple Git-117)
|
|
|