From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (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 072841A1E04 for ; Tue, 2 Aug 2016 05:04:56 -0700 (PDT) Received: by mail-io0-x22d.google.com with SMTP id m101so210118383ioi.2 for ; Tue, 02 Aug 2016 05:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jVG5EfMVe5vOHP8f9V91Nblvr+OMKiQ8ibE06WP0Xuc=; b=KfBNdf1WggDVMw9t56sw7AKnstHIXsU5TLfXnjrphf2cYYH1wFWO8mwCmZ3FCW+5iZ vCglgUfMULvMrxZICzYxIwZfatj1nbwrAkpyQ9kd5fdfjuov0EECDn2Pog//OL+XczNy FBhKzJTO8kEmQKfVxm3+S8XA3NIAC4H+0nYVg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jVG5EfMVe5vOHP8f9V91Nblvr+OMKiQ8ibE06WP0Xuc=; b=aQ55ygAwfqP2awD1cbap+Q5y3VQh+JTxj68pHQwoEA4X5q1tA4WXlPQVGWPT1dN58z G+pR9Sdo1rQXUGApQiUNqbeACOlHU0tiEECXa8t69aRtPkRtF/emZj/MWxjyatjysKzv XU4HurnuFR8+n+vNj/itvFknUHj8DV93Lp4bvZfium8ZXXtMA8ETyC02xtXzjYZD7zze AJrYz4JwuZHuQEQaYDdiuF45UNpOlu+1lF9hFIt/wJQj5TMgusuk+OHsqYMsMnKP1M4r 5XVRCZ4JaImR9KJdsPSnVApnIDNzHOwFc7+HOsJCyEyJmXGwyOKN7qNjcEguGu+o4QL5 LzaQ== X-Gm-Message-State: AEkoousI+exGYPAmNkUP15X6S4kPA/ArI34Le8fj2GGA0lCS/dHuYW8LVgy1d71i0zyFIm+9cLo2BASVG247aFF1 X-Received: by 10.107.40.133 with SMTP id o127mr58884977ioo.183.1470139495216; Tue, 02 Aug 2016 05:04:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.204.195 with HTTP; Tue, 2 Aug 2016 05:04:54 -0700 (PDT) In-Reply-To: <16ff0111-3ea6-bb24-6fd4-205356629f9e@redhat.com> References: <1470133050-6304-1-git-send-email-ard.biesheuvel@linaro.org> <16ff0111-3ea6-bb24-6fd4-205356629f9e@redhat.com> From: Ard Biesheuvel Date: Tue, 2 Aug 2016 14:04:54 +0200 Message-ID: To: Laszlo Ersek Cc: "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [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 12:04:56 -0000 Content-Type: text/plain; charset=UTF-8 On 2 August 2016 at 13:35, Laszlo Ersek wrote: > On 08/02/16 12:17, Ard Biesheuvel wrote: >> 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*) >> > > Acked-by: Laszlo Ersek Pushed as d54e2d6c1e68 Thanks