From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: Ard Biesheuvel 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: [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: , X-List-Received-Date: Tue, 02 Aug 2016 10:17:44 -0000 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(-) 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*) -- 2.7.4