mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
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@citrix.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
116 lines
3.2 KiB
Makefile
116 lines
3.2 KiB
Makefile
#
|
|
# Makefile
|
|
#
|
|
# Leendert van Doorn, leendert@watson.ibm.com
|
|
# Copyright (c) 2005, International Business Machines Corporation.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms and conditions of the GNU General Public License,
|
|
# version 2, as published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope it will be useful, but WITHOUT
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
# more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along with
|
|
# this program; If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
XEN_ROOT = $(CURDIR)/../../..
|
|
include $(XEN_ROOT)/tools/firmware/Rules.mk
|
|
|
|
# SMBIOS spec requires format mm/dd/yyyy
|
|
SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y)
|
|
|
|
CFLAGS += $(CFLAGS_xeninclude)
|
|
|
|
# We mustn't use tools-only public interfaces.
|
|
CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__
|
|
|
|
OBJS = hvmloader.o mp_tables.o util.o smbios.o
|
|
OBJS += smp.o cacheattr.o xenbus.o vnuma.o
|
|
OBJS += e820.o pci.o pir.o ctype.o
|
|
OBJS += hvm_param.o
|
|
OBJS += ovmf.o seabios.o
|
|
ifeq ($(debug),y)
|
|
OBJS += tests.o
|
|
endif
|
|
|
|
CIRRUSVGA_DEBUG ?= n
|
|
|
|
ROMBIOS_DIR := ../rombios
|
|
|
|
ifeq ($(CONFIG_ROMBIOS),y)
|
|
STDVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.bin
|
|
ifeq ($(CIRRUSVGA_DEBUG),y)
|
|
CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin
|
|
else
|
|
CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
|
|
endif
|
|
endif
|
|
|
|
ROMS :=
|
|
|
|
ifeq ($(CONFIG_ROMBIOS),y)
|
|
OBJS += optionroms.o 32bitbios_support.o rombios.o
|
|
CFLAGS += -DENABLE_ROMBIOS
|
|
ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
|
|
ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
|
|
endif
|
|
|
|
.PHONY: all
|
|
all: acpi subdirs-all
|
|
$(MAKE) hvmloader
|
|
|
|
.PHONY: acpi
|
|
acpi:
|
|
$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES)"
|
|
|
|
rombios.o: roms.inc
|
|
smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
|
|
|
|
ACPI_PATH = ../../libacpi
|
|
DSDT_FILES = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
|
|
ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES)) build.o static_tables.o
|
|
$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
|
|
CFLAGS += -I$(ACPI_PATH)
|
|
vpath build.c $(ACPI_PATH)
|
|
vpath static_tables.c $(ACPI_PATH)
|
|
OBJS += $(ACPI_OBJS)
|
|
|
|
hvmloader: $(OBJS) hvmloader.lds
|
|
$(LD) $(LDFLAGS_DIRECT) -N -T hvmloader.lds -o $@ $(OBJS)
|
|
|
|
roms.inc: $(ROMS)
|
|
echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
|
|
|
|
ifneq ($(ROMBIOS_ROM),)
|
|
echo "#ifdef ROM_INCLUDE_ROMBIOS" >> $@.new
|
|
sh ../../misc/mkhex rombios $(ROMBIOS_ROM) >> $@.new
|
|
echo "#endif" >> $@.new
|
|
endif
|
|
|
|
ifneq ($(STDVGA_ROM),)
|
|
echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
|
|
sh ../../misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
|
|
echo "#endif" >> $@.new
|
|
endif
|
|
ifneq ($(CIRRUSVGA_ROM),)
|
|
echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
|
|
sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
|
|
echo "#endif" >> $@.new
|
|
endif
|
|
mv $@.new $@
|
|
|
|
.PHONY: clean
|
|
clean: subdirs-clean
|
|
rm -f roms.inc roms.inc.new acpi.h
|
|
rm -f hvmloader hvmloader.tmp *.o $(DEPS_RM)
|
|
$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
|
|
|
|
.PHONY: distclean
|
|
distclean: clean
|
|
|
|
-include $(DEPS_INCLUDE)
|