From patchwork Tue May 30 18:36:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100728 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp352691qge; Tue, 30 May 2017 11:37:23 -0700 (PDT) X-Received: by 10.84.132.98 with SMTP id 89mr84034129ple.29.1496169443241; Tue, 30 May 2017 11:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496169443; cv=none; d=google.com; s=arc-20160816; b=FZ8cw8w5w6KnbyeRXaM1mpzwDiOkJTjOpwQPs4XMNY+7zgx9xBlQN1lOOwDryr33Gk rhANpWsGvdLnFwSZD7q7dauZYkEkFDLvga28HKlcwXgw0FkC4oS4XWa6nplYHH/7Ivso wTob6Zoz2kT9tIRkQ9479V0GeOdLSVoFq9r1ocFaZFw2r5NGbPx8e7iyLkf4n5QIw6DA hBd2CZ6KrqIYf6vgzNaEqK6SdjnUQhBhmwibtP4i9gausch/CdogzzYutJVkHdVFBowe TmzOIObGnLu2ExBgHhCg4j5hBGNrQ+GasE0YS3GC7r6Bf55O46ihnGoOG6spS0GzgKTh X4CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=q7QQLjMhyMA8ON7WH6n1LNDrqwZBWbetJWbw9E4/QjY=; b=wnoyXTvYzNyxH1iGZVdl+xRWqF7hX5r+cIOx2qu2ZMU/sN/hVufOvYGOGzp6nlV0KK z8XxNUJc6eHbEbvrnwLhPHym7t3co4owJKYFb3ugjJ44ygIOCupOwQtozCVj0zvOAytn sT7zEHxVmRWINdigMr5Q/tIgb+j/CKWrSpmIZf7ZCdWODjuoTDS0f0IQleoEL+ld6Pou xc0xpFTDnKBQ/SDwPcFX/0+XHbTrQnTpanFB40XL6E002s7fd/TtdVh0uBff2ffrO8M9 JKIHXg3RNYq36U/19Pi1XUhpeHaRQpfIgLbX9n+nHgnoKN5zXB9jI5tEaY2QeJsZyVFK QacA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si44904691plf.190.2017.05.30.11.37.22; Tue, 30 May 2017 11:37:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751209AbdE3ShO (ORCPT + 2 others); Tue, 30 May 2017 14:37:14 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:35970 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234AbdE3ShL (ORCPT ); Tue, 30 May 2017 14:37:11 -0400 Received: by mail-wm0-f45.google.com with SMTP id 7so99021824wmo.1 for ; Tue, 30 May 2017 11:37:05 -0700 (PDT) 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; bh=I1sTB5ahI02iYwJJM3Y8VreDzUCl2Pn2ToPN8htznMY=; b=FK0W92TQKI0H+1kH+z+dzOh39hl0AEjlizrK/dqciXYr/Pxo1IMpxtPSeSga5lon1A Tve6YI4rz88kemNjrw4oE1zMMJRHmZr2D4fyGu/OVD1wWjlFXLrYT0td9v4+EP+Fa14x OFmjrGVh7Sc22nhMHfUCJYYdaYxzEXJy/dtCw= 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; bh=I1sTB5ahI02iYwJJM3Y8VreDzUCl2Pn2ToPN8htznMY=; b=CragX7SeKEdSGd8sE8SfkQDjH/kT1XxyeAeWZb5IqbcmzgSUJXSTPP9E/bQ47pKxQI wyg1DP4fgLasjeEGZU6d/e4M4w01SOBqRXkkh0WfPpEEFQ/yOGkFvlmfuyXKUfnDTIJs RZi9CRKIziFGTMephOmaG8ThdlwY9MUvkhmnXWz+4OoKj6aYA4YUwWTgRyLk9jpHyq2g 2TfzC1vUADhdEW1ErnlNUCzYilhH0g0g9go2N+ZIaGVagSUzSk/kD2KMirdYAhLcGYoT 8L29OenTWPifN2FI/1AIVJSHZnzt/amJEd+xg8UAeTOHKHe6TT44CmKQeMjE6s0ip3T1 byog== X-Gm-Message-State: AODbwcBQ1Bqirod855yoTcPLl5qBFBZ2gzAmaGVsDAiSwWGKvg8rCQkT ffPZO85c46hOHd0x8oHACQ== X-Received: by 10.28.216.129 with SMTP id p123mr2613728wmg.55.1496169419611; Tue, 30 May 2017 11:36:59 -0700 (PDT) Received: from localhost.localdomain ([154.144.49.177]) by smtp.gmail.com with ESMTPSA id b8sm15935997wrb.7.2017.05.30.11.36.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2017 11:36:58 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux@armlinux.org.uk Cc: linux-arm-kernel@lists.infradead.org, matt@codeblueprint.co.uk, leif.lindholm@linaro.org, Ard Biesheuvel Subject: [PATCH 2/7] arm: efi: remove pointless dummy .reloc section Date: Tue, 30 May 2017 18:36:42 +0000 Message-Id: <20170530183647.28557-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170530183647.28557-1-ard.biesheuvel@linaro.org> References: <20170530183647.28557-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The kernel's EFI PE/COFF header contains a dummy .reloc section, and an explanatory comment that claims that this is required for the EFI application loader to accept the Image as a relocatable image (i.e., one that can be loaded at any offset and fixed up in place) This was inherited from the x86 implementation, which has elaborate host tooling to mangle the PE/COFF header post-link time, and which populates the .reloc section with a single dummy base relocation. On ARM, no such tooling exists, and the .reloc section remains empty, and is never even exposed via the BaseRelocationTable directory entry, which is where the PE/COFF loader looks for it. The PE/COFF spec is unclear about relocatable images that do not require any fixups, but the EDK2 implementation, which is the de facto reference for PE/COFF in the UEFI space, clearly does not care, and explicitly mentions (in a comment) that relocatable images with no base relocations are perfectly fine, as long as they don't have the RELOCS_STRIPPED attribute set (which is not the case for our PE/COFF image) So simply remove the .reloc section altogether. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/efi-header.S | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S index f9e91ba4d0b1..97f595970916 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -40,7 +40,7 @@ pe_header: coff_header: .short 0x01c2 @ ARM or Thumb - .short 2 @ nr_sections + .short 1 @ nr_sections .long 0 @ TimeDateStamp .long 0 @ PointerToSymbolTable .long 0 @ NumberOfSymbols @@ -95,22 +95,6 @@ extra_header_fields: .quad 0 @ BaseRelocationTable section_table: - @ - @ The EFI application loader requires a relocation section - @ because EFI applications must be relocatable. This is a - @ dummy section as far as we are concerned. - @ - .ascii ".reloc\0\0" - .long 0 @ VirtualSize - .long 0 @ VirtualAddress - .long 0 @ SizeOfRawData - .long 0 @ PointerToRawData - .long 0 @ PointerToRelocations - .long 0 @ PointerToLineNumbers - .short 0 @ NumberOfRelocations - .short 0 @ NumberOfLineNumbers - .long 0x42000040 @ Characteristics - .ascii ".text\0\0\0" .long _end - __efi_start @ VirtualSize .long __efi_start @ VirtualAddress