From patchwork Thu Aug 23 09:20:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 10573647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B9AF112E for ; Thu, 23 Aug 2018 09:20:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 963B62BCDC for ; Thu, 23 Aug 2018 09:20:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 934092BBFE; Thu, 23 Aug 2018 09:20:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08CA82BCBA for ; Thu, 23 Aug 2018 09:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730554AbeHWMs4 (ORCPT ); Thu, 23 Aug 2018 08:48:56 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35866 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727646AbeHWMs4 (ORCPT ); Thu, 23 Aug 2018 08:48:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1A2B400C3A1; Thu, 23 Aug 2018 09:20:06 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.43.2.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id C968B2157F4A; Thu, 23 Aug 2018 09:20:05 +0000 (UTC) From: Andrew Jones To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, andre.przywara@arm.com Subject: [PATCH kvm-unit-tests 1/2] arm/arm64: prepare to compile arm64 tests relocatable Date: Thu, 23 Aug 2018 11:20:02 +0200 Message-Id: <20180823092003.6076-2-drjones@redhat.com> In-Reply-To: <20180823092003.6076-1-drjones@redhat.com> References: <20180823092003.6076-1-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 23 Aug 2018 09:20:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 23 Aug 2018 09:20:06 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'drjones@redhat.com' RCPT:'' Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Andrew Jones --- arm/Makefile.arm | 6 +++++- arm/Makefile.arm64 | 6 +++++- arm/Makefile.common | 19 +++++++------------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/arm/Makefile.arm b/arm/Makefile.arm index 6b57284382aa..a625267a9c02 100644 --- a/arm/Makefile.arm +++ b/arm/Makefile.arm @@ -5,7 +5,6 @@ # bits = 32 ldarch = elf32-littlearm -kernel_offset = 0x10000 machine = -marm # stack.o relies on frame pointers. @@ -14,6 +13,11 @@ KEEP_FRAME_POINTER := y CFLAGS += $(machine) CFLAGS += -mcpu=$(PROCESSOR) +arch_LDFLAGS = -Ttext=40010000 + +define arch_elf_check = +endef + cstart.o = $(TEST_DIR)/cstart.o cflatobjs += lib/arm/spinlock.o cflatobjs += lib/arm/processor.o diff --git a/arm/Makefile.arm64 b/arm/Makefile.arm64 index f04bbf476763..782d4faa5cdc 100644 --- a/arm/Makefile.arm64 +++ b/arm/Makefile.arm64 @@ -5,7 +5,11 @@ # bits = 64 ldarch = elf64-littleaarch64 -kernel_offset = 0x80000 + +arch_LDFLAGS = -Ttext=40080000 + +define arch_elf_check = +endef cstart.o = $(TEST_DIR)/cstart64.o cflatobjs += lib/arm64/processor.o diff --git a/arm/Makefile.common b/arm/Makefile.common index 1cf9cdcf078e..57c3363a36f2 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -4,11 +4,6 @@ # Authors: Andrew Jones # -ifeq ($(LOADADDR),) - # qemu mach-virt default load address - LOADADDR = 0x40000000 -endif - tests-common = $(TEST_DIR)/selftest.flat tests-common += $(TEST_DIR)/spinlock-test.flat tests-common += $(TEST_DIR)/pci-test.flat @@ -23,7 +18,6 @@ all: directories $(tests-all) $(TEST_DIR)/sieve.elf: AUXFLAGS = 0x1 ################################################################## -phys_base = $(LOADADDR) AUXFLAGS ?= 0x0 CFLAGS += -std=gnu99 @@ -64,17 +58,18 @@ libeabi = lib/arm/libeabi.a eabiobjs = lib/arm/eabi_compat.o libgcc := $(shell $(CC) $(machine) --print-libgcc-file-name) -start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) ))) FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi) -%.elf: LDFLAGS = $(CFLAGS) -nostdlib +%.elf: LDFLAGS = -nostdlib $(arch_LDFLAGS) %.elf: %.o $(FLATLIBS) $(SRCDIR)/arm/flat.lds $(cstart.o) - $(CC) $(LDFLAGS) -o $@ \ - -Wl,-T,$(SRCDIR)/arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \ - $(filter %.o, $^) $(FLATLIBS) \ - $(SRCDIR)/lib/auxinfo.c -DPROGNAME=\"$(@:.elf=.flat)\" -DAUXFLAGS=$(AUXFLAGS) + $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c \ + -DPROGNAME=\"$(@:.elf=.flat)\" -DAUXFLAGS=$(AUXFLAGS) + $(LD) $(LDFLAGS) -o $@ -T $(SRCDIR)/arm/flat.lds \ + $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o) + $(RM) $(@:.elf=.aux.o) %.flat: %.elf + $(call arch_elf_check, $^) $(OBJCOPY) -O binary $^ $@ $(libeabi): $(eabiobjs)