svn commit: r477953 - in head/sysutils/xen-tools411: . files
Roger Pau Monné
royger at FreeBSD.org
Fri Aug 24 10:10:47 UTC 2018
Author: royger (src committer)
Date: Fri Aug 24 10:10:45 2018
New Revision: 477953
URL: https://svnweb.freebsd.org/changeset/ports/477953
Log:
xen-tools411: build a working hvmloader
... when using LLVM LD. Add a patch that fixes hvmloader build with
LLVM LD. Without this patch the generated hvmloader doesn't work
properly.
Sponsored by: Citrix Systems R&D
Added:
head/sysutils/xen-tools411/files/0001-hvmloader-fix-build-with-LLVM-Linker.patch (contents, props changed)
Modified:
head/sysutils/xen-tools411/Makefile
Modified: head/sysutils/xen-tools411/Makefile
==============================================================================
--- head/sysutils/xen-tools411/Makefile Fri Aug 24 09:38:10 2018 (r477952)
+++ head/sysutils/xen-tools411/Makefile Fri Aug 24 10:10:45 2018 (r477953)
@@ -3,7 +3,7 @@
PORTNAME= xen
PKGNAMESUFFIX= -tools411
PORTVERSION= 4.11.0
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= sysutils emulators
MASTER_SITES= http://downloads.xenproject.org/release/xen/${PORTVERSION}/
@@ -48,6 +48,8 @@ EXTRA_PATCHES+= ${FILESDIR}/0001-docs-use-the-make-wil
# XSA-273 and XSA-272
EXTRA_PATCHES+= ${FILESDIR}/0031-tools-oxenstored-Make-evaluation-order-explicit.patch:-p1 \
${FILESDIR}/0041-xl.conf-Add-global-affinity-masks.patch:-p1
+# Fix hvmloader build with LLVM LD
+EXTRA_PATCHES+= ${FILESDIR}/0001-hvmloader-fix-build-with-LLVM-Linker.patch:-p1
CONFIGURE_ARGS+= --with-system-seabios=${LOCALBASE}/share/seabios/bios.bin
Added: head/sysutils/xen-tools411/files/0001-hvmloader-fix-build-with-LLVM-Linker.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sysutils/xen-tools411/files/0001-hvmloader-fix-build-with-LLVM-Linker.patch Fri Aug 24 10:10:45 2018 (r477953)
@@ -0,0 +1,101 @@
+From 9aa8c031ce844ada6832a56d3b25341bed2825db Mon Sep 17 00:00:00 2001
+From: Roger Pau Monne <roger.pau at citrix.com>
+Date: Fri, 24 Aug 2018 10:14:28 +0200
+Subject: [PATCH] hvmloader: fix build with LLVM Linker
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The hvmloader binary generated when using LLVM LD doesn't work
+properly and seems to get stuck while trying to generate and load the
+ACPI tables. This is caused by the layout of the binary when linked
+with LLVM LD.
+
+LLVM LD has a different default linker script that GNU LD, and the
+resulting hvmloader binary is slightly different:
+
+LLVM LD:
+Program Headers:
+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
+ PHDR 0x000034 0x000ff034 0x000ff034 0x00060 0x00060 R 0x4
+ LOAD 0x000000 0x000ff000 0x000ff000 0x38000 0x38000 RWE 0x1000
+ GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0
+
+GNU LD:
+Program Headers:
+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
+ LOAD 0x000080 0x00100000 0x00100000 0x36308 0x3fd74 RWE 0x10
+ GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
+
+Note that in the LLVM LD case (as with GNU LD) the .text section does
+indeed have the address set to 0x100000 as requested on the command
+line:
+
+[ 1] .text PROGBITS 00100000 001000 00dd10 00 AX 0 0 16
+
+There's however the PHDR which is not present when using GNU LD.
+
+Fix this by using a very simple linker script that generates the same
+binary regardless of whether LLVM or GNU LD is used. By using a linker
+script the usage of -Ttext can also be avoided by placing the desired
+.text load address directly in the linker script.
+
+Signed-off-by: Roger Pau Monné <roger.pau at citrix.com>
+---
+Jan Beulich <jbeulich at suse.com>
+Andrew Cooper <andrew.cooper3 at citrix.com>
+Wei Liu <wei.liu2 at citrix.com>
+Ian Jackson <ian.jackson at eu.citrix.com>
+---
+ tools/firmware/hvmloader/Makefile | 7 ++-----
+ tools/firmware/hvmloader/hvmloader.lds | 13 +++++++++++++
+ 2 files changed, 15 insertions(+), 5 deletions(-)
+ create mode 100644 tools/firmware/hvmloader/hvmloader.lds
+
+diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile
+index 496ac72b77..e980ce7c5f 100644
+--- a/tools/firmware/hvmloader/Makefile
++++ b/tools/firmware/hvmloader/Makefile
+@@ -20,9 +20,6 @@
+ XEN_ROOT = $(CURDIR)/../../..
+ include $(XEN_ROOT)/tools/firmware/Rules.mk
+
+-
+-LOADADDR = 0x100000
+-
+ # SMBIOS spec requires format mm/dd/yyyy
+ SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y)
+
+@@ -82,8 +79,8 @@ vpath build.c $(ACPI_PATH)
+ vpath static_tables.c $(ACPI_PATH)
+ OBJS += $(ACPI_OBJS)
+
+-hvmloader: $(OBJS)
+- $(LD) $(LDFLAGS_DIRECT) -N -Ttext $(LOADADDR) -o $@ $^
++hvmloader: $(OBJS) hvmloader.lds
++ $(LD) $(LDFLAGS_DIRECT) -N -T hvmloader.lds -o $@ $(OBJS)
+
+ roms.inc: $(ROMS)
+ echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
+diff --git a/tools/firmware/hvmloader/hvmloader.lds b/tools/firmware/hvmloader/hvmloader.lds
+new file mode 100644
+index 0000000000..15d8f38fff
+--- /dev/null
++++ b/tools/firmware/hvmloader/hvmloader.lds
+@@ -0,0 +1,13 @@
++SECTIONS
++{
++ . = 0x100000;
++ /*
++ * NB: there's no need to use the AT keyword in order to set the LMA, by
++ * default the linker will use VMA = LMA unless specified otherwise.
++ */
++ .text : { *(.text) }
++ .rodata : { *(.rodata) }
++ .data : { *(.data) }
++ .bss : { *(.bss) }
++ _end = .;
++}
+--
+2.18.0
+
More information about the svn-ports-head
mailing list