From patchwork Mon Nov 5 18:44:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10668921 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 A3F6817D4 for ; Mon, 5 Nov 2018 18:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 912A529973 for ; Mon, 5 Nov 2018 18:45:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82B25295E2; Mon, 5 Nov 2018 18:45:47 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A6F9295E2 for ; Mon, 5 Nov 2018 18:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kj04jH6NRe/I9701ytcGsXbKPu4WV5gxm2ugXTJVqyU=; b=S+jJ+E3eOWO9Rk S4kz6Y8sv7z95+FAsQe8X3UD1VEuFVOu22yRePcHvjUK21jLaMeMpyXpuDoxGlBrcWiZHjrnWDQq8 eoxRsN8LC366cWbHL7f810YVd4HLk/o3DVPlEutDpUJIeWRx3rThlIrd9viLUGVrEejWtRjuCD7JL Q35zQIcXg3K3cRw24m1CNDKoUfUL/AlZrRq8gzVAohl2Wl84A+3NJB1rTdvcpQipMwHfEMu7JEuL4 /2WjnYQMwOskvX9WCBxlX/Sfwuqy1G9bYlLbqmkq5VVHvUp4BN0CPGRFaNH8ZLPkBDvEs/wbp1B6m Nux7xptFTUhLi1W9ZByQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjsb-0003rQ-Ht; Mon, 05 Nov 2018 18:45:41 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjs4-0001ub-HU for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2018 18:45:10 +0000 Received: by mail-wr1-x444.google.com with SMTP id j26-v6so10709022wre.1 for ; Mon, 05 Nov 2018 10:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9y8+g96hCUUZ6vKnBMo6NYhR9zdxtsgrLZRQMdgKz9w=; b=N/J+IS+OqjqYsH7xyTMDiE5kYmGolSL3zVnTquXR43uvDF5suKtbxoUSNryzZ/enUh GJbDVkjoVpl7bpQs4qTGMg4P6A5782exF1Vd3YXlXxVoqt4ncAiseDkRWBiRLUEkAUDJ 0GbeRMcnN7Nt6drNVMfeZuc5oetyUnES0nDNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9y8+g96hCUUZ6vKnBMo6NYhR9zdxtsgrLZRQMdgKz9w=; b=grw2HTo+uZzMLKUY1QQpak4EkFcL75imO67DQqeiKVtefETGArVi+yqSoFhIBFUpLB XOWs3NKN4pxGLCSvG0GmNMVE8q2ry4J+SLdvt43EMQKyr+//87hc71d6pTzVGHT5321b ShBjgPjK2qRIsAoutt+Xxh74BZZRFnMtrUu8lII2dx0FFJ70EdWJ/6kFdXZGRei7Lhbe WBrEj/aPJ9ENvozVYIj5B6siLK3iQJSOHKuSA79A+YpbJsUZkwyt/1R2FjHtqHdTcJ9b ZZATbO0teGNlZZQsom65yUbO2C7Eip6OpAjvgWS6wze4sy3IyLGQKrlgOdDPuzmB5exr cxIA== X-Gm-Message-State: AGRZ1gLYz+6N84mJ6hlwhRNcYlVO2EDtFBjL4wB8RjQexPbwKLkomjVc tnAKP+HcLehFv5J3nFeM/jiXkDI2TFQ= X-Google-Smtp-Source: AJdET5e9YP5djycjkIY/0/qQ4JKJFiwarskffeH7LAy4dV8U1Cqp2f6k4CD86IquvAMonnAF2O/Ahw== X-Received: by 2002:a5d:6585:: with SMTP id q5-v6mr20057101wru.141.1541443498961; Mon, 05 Nov 2018 10:44:58 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3117:2b29:5ef7:a9e5]) by smtp.gmail.com with ESMTPSA id y21-v6sm19329761wma.36.2018.11.05.10.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 10:44:58 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/6] ARM: compressed: put zImage header and EFI header in dedicated section Date: Mon, 5 Nov 2018 19:44:37 +0100 Message-Id: <20181105184438.19494-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105184438.19494-1-ard.biesheuvel@linaro.org> References: <20181105184438.19494-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_104508_672553_9E86B4FD X-CRM114-Status: GOOD ( 14.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicolas.pitre@linaro.org, linux@armlinux.org.uk, Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP To align the PE/COFF and the ELF headers of the decompressor binary, put the zImage header and the EFI header in a separate .start section, and emit it at the start of the Image. This change is necessary for UEFI based debug tooling to be able to use the vmlinux ELF binary, since it gets confused if the PE/COFF .text section and the ELF .text section live at different offsets. With this change, we also stop relying on the code to flow from one section to the next simply because the order in which the linker emits the sections happens to be what we expect. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/head.S | 6 +++--- arch/arm/boot/compressed/vmlinux.lds.S | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 55c227077207..e3c43fdb6371 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -176,6 +176,8 @@ start: .word _magic_table @ additional data table __EFI_HEADER + + .text 1: ARM_BE8( setend be ) @ go BE8 if compiled for BE8 AR_CLASS( mrs r9, cpsr ) @@ -209,10 +211,8 @@ not_angel: /* * some architecture specific code can be inserted - * by the linker here, but it should preserve r7, r8, and r9. + * here, but it should preserve r7, r8, and r9. */ - - .text #ifdef CONFIG_PXA_SHARPSL_DETECT_MACH_ID bl __SharpSL_start #endif diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S index 2b963d8e76dd..ad9921490034 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.S +++ b/arch/arm/boot/compressed/vmlinux.lds.S @@ -34,9 +34,11 @@ SECTIONS . = TEXT_START; _text = .; - .text : { + .start : { _start = .; *(.start) + } + .text : { *(.text) *(.text.*) *(.fixup)