From patchwork Thu Apr 14 16:27:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12813708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78051C433EF for ; Thu, 14 Apr 2022 16:28:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.304940.519698 (Exim 4.92) (envelope-from ) id 1nf2K7-0006Iv-Lx; Thu, 14 Apr 2022 16:27:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 304940.519698; Thu, 14 Apr 2022 16:27:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nf2K7-0006Io-Iu; Thu, 14 Apr 2022 16:27:59 +0000 Received: by outflank-mailman (input) for mailman id 304940; Thu, 14 Apr 2022 16:27:59 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nf2K6-0006Ii-V4 for xen-devel@lists.xenproject.org; Thu, 14 Apr 2022 16:27:58 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d7129773-bc0f-11ec-a405-831a346695d4; Thu, 14 Apr 2022 18:27:57 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d7129773-bc0f-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1649953677; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YpbrNsO5eqU21GpQZ9G2rrY/TRBO8lp6nInT+GXGccI=; b=Vdv6JI0vOsqW64hdqk0wtU+/Sc0pvwcd4t8ZVC1y/HsHNRYIE7L1xXlO 3YTZ1em88Lmh6YAEV93cEhzbeuwrNyeglIC5Pos2mKYwuZwEOdqKl6m7/ ZZchyyEGIdBFT3GMar4e1ZxARL+FDxHy9/1UoRSmvWspQe3HcS4josggH g=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 68981224 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:dQx8YKABLndCEhVW/yzjw5YqxClBgxIJ4kV8jS/XYbTApG52gmMPy modWW+OO6qMYmqjft9wYYuw/BwC6sTcnNVjQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaA4E/raNANlFEkvU2ybuOU5NXsZ2YgHWeIdA970Ug5w7Jg3tYy6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPh/8 Mxzn5mVEz4gJ7HooO4dTBwFSCZhaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguwKKsXxMZxZkXZn1TzDVt4tQIzZQrWM7thdtNs1rp4eTKaHP ZBFAdZpRA7+SQJ0GXYSMcMVgryBuHjaTht6rk3A8MLb5ECMlVcsgdABKuH9ZdiiVchT2EGCq Qru3U70HxUbP9y30iee/zSngeqntTP2XsceGaO18tZugUaP3SoDBRsOT1y5rPKlzEmkVLpix 1c8o3R06/JorQryE4e7D0bQTGO4UgA0VeJJLcc/zVu0w7PIxz6TBncBE2VGd4lz3CMpfgAC2 liMltLvIDVgtryJVH6QnoupQSOO1Ts9djFbO3JdJecRy5y6+dxo0EqTJjp2OPTt5uAZDw0c1 NxjQMIWo7wIxfAG2Kyglbwsq2L9/8OZJuLZC+i+Y45E0u+bTNP9D2BLwQKChRqlEGp/ZgPQ1 JTjs5LAhN3i9bnXyESwrBwlRdlFHcqtPjzGmkJIFJI87Tmr8HPLVdkOvGAufh8wbJpfImKBj KrvVeV5vs470JyCN/EfXm5MI55ykfiI+SrNC5g4keaikrAuLVTarUmClGab3nz3kVhErE3ME czzTCpYNl5DUf4P5GPvH481iOZ3rghjlTK7bc2qlHyPjOvBDEN5vJ9YaTNimMhit/jayOgUm v4CX/a3J+J3CbSgOXiGrdROdTjn7xETXPjLliCeTcbbSiIOJY3rI6W5LW8JE2C9o5loqw== IronPort-HdrOrdr: A9a23:SFltrao3E1Y8mB/+awMcrCkaV5oTeYIsimQD101hICG8cqSj+f xG+85rrCMc6QxhPk3I9urhBEDtex/hHNtOkOws1NSZLW7bUQmTXeJfBOLZqlWKcUDDH6xmpM NdmsBFeaXN5DNB7PoSjjPWLz9Z+qjkzJyV X-IronPort-AV: E=Sophos;i="5.90,260,1643691600"; d="scan'208";a="68981224" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Anthony PERARD Subject: [PATCH v1.1 2/3] x86/build: Don't convert boot/{cmdline,head}.bin back to .S Date: Thu, 14 Apr 2022 17:27:39 +0100 Message-ID: <20220414162739.7251-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220414114708.4788-3-andrew.cooper3@citrix.com> References: <20220414114708.4788-3-andrew.cooper3@citrix.com> MIME-Version: 1.0 There's no point wasting time converting binaries back to asm source. Just use .incbin directly. Explain in head.S what these binaries are. Also, align the blobs. While there's very little static data in the blobs, they should have at least 4 byte alignment. There was previously no guarantee that cmdline_parse_early was aligned, and there is no longer an implicit 4-byte alignment between cmdline_parse_early and reloc caused by the use of .long. No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Anthony PERARD v1.1: * Rebase over the out-of-tree build work Cleanup to $(head-srcs) deferred to the subsequent patch to make the change legible. --- xen/arch/x86/boot/Makefile | 9 ++++----- xen/arch/x86/boot/head.S | 10 ++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index a5dd094836f6..0670e03b72e0 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -10,7 +10,10 @@ head-srcs := $(addprefix $(obj)/, $(head-srcs)) ifdef building_out_of_srctree $(obj)/head.o: CFLAGS-y += -iquote $(obj) endif -$(obj)/head.o: $(head-srcs) +# For .incbin - add $(obj) to the include path and add the dependencies +# manually as they're not included in .d +$(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj) +$(obj)/head.o: $(head-srcs:.S=.bin) CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) @@ -24,10 +27,6 @@ CFLAGS_x86_32 += -I$(srctree)/include $(head-srcs:.S=.o): CFLAGS_stack_boundary := $(head-srcs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic -$(head-srcs): %.S: %.bin - (od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \ - sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@ - %.bin: %.lnk $(OBJCOPY) -j .text -O binary $< $@ diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 3db47197b841..0fb7dd3029f2 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -777,11 +777,17 @@ trampoline_setup: /* Jump into the relocated trampoline. */ lret + /* + * cmdline and reloc are written in C, and linked to be 32bit PIC with + * entrypoints at 0 and using the stdcall convention. + */ + ALIGN cmdline_parse_early: -#include "cmdline.S" + .incbin "cmdline.bin" + ALIGN reloc: -#include "reloc.S" + .incbin "reloc.bin" ENTRY(trampoline_start) #include "trampoline.S"