From patchwork Tue Aug 2 10:17:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 73151 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp73816qga; Tue, 2 Aug 2016 03:17:47 -0700 (PDT) X-Received: by 10.66.72.10 with SMTP id z10mr6726204pau.63.1470133067053; Tue, 02 Aug 2016 03:17:47 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id xv4si2420232pab.153.2016.08.02.03.17.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Aug 2016 03:17:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; 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 edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5B08F1A1E13; Tue, 2 Aug 2016 03:17:46 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 69BE81A1E12 for ; Tue, 2 Aug 2016 03:17:44 -0700 (PDT) Received: by mail-wm0-x233.google.com with SMTP id o80so282589168wme.1 for ; Tue, 02 Aug 2016 03:17:44 -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; bh=PMdIUTW4sWcCbyyjpvfsnw9pvoqN/y4bR670h9TRzd8=; b=Utukd1jZlIUIORmQkyoHsgPE2wFDJRaY9NnA97vB1WMnUBJiLqFVNAhhfDqgof55yy LylOY9flCQEb6YsvmOTqX5xYcx7+dWfYml/KpszrL1afhxPSswHRDRUxBpCoh6NsxnCy QJ/swRAoCawLCw1iIC6tWiRLGT4thfBcLDKUQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PMdIUTW4sWcCbyyjpvfsnw9pvoqN/y4bR670h9TRzd8=; b=lAxJasn/TSSMKN+yjpNCShgr+/MhTslEfLqa5U1iTFupY31KZAyC0Lxg0OQR+u/WmN 0UFNk93QOBbj3vl0U3whzJEof2zNHlhymCwaq2lM2+gzJ5ota5WzHu1jQjGB+NziBzv7 A0dZuo0A32aYUhCMHO7EDv/qJ5dHD3KZ4v921uYQPqJnOVjw2N9C83MYjJl7/jbqhYEF 19BM97VoG/Qk5wsO83hsC1dnA16kfw7CS5hBsWl0+G8fMXGV9a/ut6b5KYgC25Yk8Q1Q hnvHyJARjfi3xO+/sBhjo13A3lGUMbQFxGzjtNDUHBWAfbodCcaZI9X+eb/yXkGjAUI/ B5kQ== X-Gm-Message-State: AEkoouvWfkam2EJBukHCuI4XGqyrHP3JkdLnAhgtU4qIPyChbA06gmekzuWTzqUdcW3tTAiq X-Received: by 10.28.134.14 with SMTP id i14mr58083203wmd.59.1470133062079; Tue, 02 Aug 2016 03:17:42 -0700 (PDT) Received: from localhost.localdomain (3.red-81-34-118.dynamicip.rima-tde.net. [81.34.118.3]) by smtp.gmail.com with ESMTPSA id r16sm21318935wme.16.2016.08.02.03.17.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Aug 2016 03:17:41 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, lersek@redhat.com Date: Tue, 2 Aug 2016 12:17:30 +0200 Message-Id: <1470133050-6304-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: deal with relaxed XIP alignment X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Commit b89919ee8f8c ("BaseTools AARCH64: override XIP module linker alignment to 32 bytes") updated the various AARCH64 toolchain definitions to allow SEC, PEI_CORE and PEIM modules to be built with minimal alignment requirements even when using the AArch64 small code model which normally requires 4 KB section alignment. This involves conversion of ADRP instructions into ADR instructions, which can only be done reliably if the ELF and the PE/COFF sections appear at the same offset modulo 4 KB. The ArmVirtPrePiUniCoreRelocatable linker script did not yet take this into account, so update it by starting the .text section at the next appropriately aligned offset PECOFF_HEADER_SIZE bytes into the image. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- This fixes the ArmVirtQemuKernel and ArmVirtXen platforms, which are currently broken when using DEBUG_GCC49, DEBUG_GCC5 or *_CLANG35 (all of which received the linker alignment treatment mentioned above) Symptoms: many occurrences of ... GenFw: ERROR 3000: Invalid WriteSections64(): <../ArmVirtPrePiUniCoreRelocatable.dll> AARCH64 small code model requires identical ELF and PE/COFF section offsets modulo 4 KB. ... and a failed build. ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Acked-by: Laszlo Ersek diff --git a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds index 44df7840adfd..492a8fff380f 100644 --- a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds +++ b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds @@ -14,9 +14,10 @@ SECTIONS { - .text 0x0 : ALIGN(CONSTANT(COMMONPAGESIZE)) { - PROVIDE(__reloc_base = .); + PROVIDE(__reloc_base = .); + . = PECOFF_HEADER_SIZE; + .text : ALIGN(CONSTANT(COMMONPAGESIZE)) { *(.text .text*) *(.got .got*) *(.rodata .rodata*)