From patchwork Mon Jul 21 15:16:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 33980 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4B84520672 for ; Mon, 21 Jul 2014 15:19:24 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf51435646pdb.1 for ; Mon, 21 Jul 2014 08:19:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=oylChKHFVaIKUogdrke8KfGV1eF6jEEp7W1wNfG0x6w=; b=CfCtPBlDq7O5csNPz6BFynXHB/BtypNZ2oOCf2lwA2vfFW7EtOUAi80CXskkTNz1ZC yl8z0/SI32fmP3A4PWg1MlcW7c/wBz1YbanJkLELBbVncPwJ9HtKn0/Hw0DmVR4TJCJt PrP7KJvtm5ts2DxnlzQWIUhV4bi9eeRoQ31rXtw3wDZiVJApWmUZAd4BflVkZMlzjujW pwJw/51bkwTgChjcFejK+/lXBrKrdID4ZUklOMNBLwAS1/puwi2cNw+ZQouiUkTmNgq+ NpG9S0A2VjqSw+iwQAViukK5ZY6HIgbX7FMCpFh+xdb7o28RAFblO0yNlLB6zttmrLPT ohog== X-Gm-Message-State: ALoCoQkFKGLNjjP+3P8tMKdcfV3UCrkLE31gJ3wIRHx1gBxfufihpGYazqN5VFMwQskRPcWJKDIe X-Received: by 10.66.222.9 with SMTP id qi9mr12843161pac.28.1405955963596; Mon, 21 Jul 2014 08:19:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.239 with SMTP id l102ls1964591qgd.81.gmail; Mon, 21 Jul 2014 08:19:23 -0700 (PDT) X-Received: by 10.52.13.98 with SMTP id g2mr25617802vdc.46.1405955963385; Mon, 21 Jul 2014 08:19:23 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id nu8si11575400vcb.16.2014.07.21.08.19.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 08:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so12048892vcb.26 for ; Mon, 21 Jul 2014 08:19:17 -0700 (PDT) X-Received: by 10.221.34.13 with SMTP id sq13mr30518495vcb.16.1405955957232; Mon, 21 Jul 2014 08:19:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp121000vcb; Mon, 21 Jul 2014 08:19:16 -0700 (PDT) X-Received: by 10.70.138.102 with SMTP id qp6mr4554097pdb.132.1405955956295; Mon, 21 Jul 2014 08:19:16 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id op8si1236634pbc.18.2014.07.21.08.19.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Jul 2014 08:19:16 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9FLx-0007wE-I8; Mon, 21 Jul 2014 15:18:13 +0000 Received: from mail-wg0-f42.google.com ([74.125.82.42]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9FLI-000715-RL for linux-arm-kernel@lists.infradead.org; Mon, 21 Jul 2014 15:17:33 +0000 Received: by mail-wg0-f42.google.com with SMTP id l18so6463435wgh.1 for ; Mon, 21 Jul 2014 08:17:08 -0700 (PDT) X-Received: by 10.194.71.52 with SMTP id r20mr23137535wju.113.1405955828180; Mon, 21 Jul 2014 08:17:08 -0700 (PDT) Received: from ards-macbook-pro.local ([212.91.105.246]) by mx.google.com with ESMTPSA id ft17sm38327602wjc.14.2014.07.21.08.16.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 08:17:07 -0700 (PDT) From: Ard Biesheuvel To: matt.fleming@intel.com, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, leif.lindholm@linaro.org Subject: [RFC PATCH 04/10] arm64: add EFI little endian constants to linker script Date: Mon, 21 Jul 2014 17:16:19 +0200 Message-Id: <1405955785-13477-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1405955785-13477-1-git-send-email-ard.biesheuvel@linaro.org> References: <1405955785-13477-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140721_081733_082261_B86A0873 X-CRM114-Status: GOOD ( 11.16 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.42 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.42 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: roy.franz@linaro.org, victor.kamensky@linaro.org, steve.capper@linaro.org, Ard Biesheuvel , msalter@redhat.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Similar to how text offset and kernel size are mangled to produce little endian constants for the Image header regardless of the endianness of the kernel, this adds a number of constants used in the EFI PE/COFF header which can only be calculated (and byte swapped) by the linker. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/image.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h index 8fae0756e175..f5a2f298810d 100644 --- a/arch/arm64/kernel/image.h +++ b/arch/arm64/kernel/image.h @@ -37,8 +37,10 @@ (((data) & 0x0000ff0000000000) >> 24) | \ (((data) & 0x00ff000000000000) >> 40) | \ (((data) & 0xff00000000000000) >> 56)) +#define DATA_LE32(data) (DATA_LE64(data) >> 32) #else #define DATA_LE64(data) ((data) & 0xffffffffffffffff) +#define DATA_LE32(data) ((data) & 0xffffffff) #endif #ifdef CONFIG_CPU_BIG_ENDIAN @@ -57,6 +59,18 @@ #define HEAD_SYMBOLS \ _kernel_size_le = DATA_LE64(_end - _text); \ _kernel_offset_le = DATA_LE64(TEXT_OFFSET); \ - _kernel_flags_le = DATA_LE64(__HEAD_FLAGS); + _kernel_flags_le = DATA_LE64(__HEAD_FLAGS); \ + EFI_HEAD_SYMBOLS + +#ifdef CONFIG_EFI +#define EFI_HEAD_SYMBOLS \ + _efi_stext_offset_le = DATA_LE32(stext_offset); \ + _efi_code_virtsize_le = DATA_LE32(_end - _text - stext_offset); \ + _efi_code_rawsize_le = DATA_LE32(_edata - _text - stext_offset); \ + _efi_image_size_le = DATA_LE32(_end - _text); \ + _efi_entry_point_le = DATA_LE32(efi_stub_entry - _text); +#else +#define EFI_HEAD_SYMBOLS +#endif #endif /* __ASM_IMAGE_H */