From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1CE431A1E12 for ; Tue, 2 Aug 2016 04:35:30 -0700 (PDT) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A63F23F720; Tue, 2 Aug 2016 11:35:29 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-83.phx2.redhat.com [10.3.116.83]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u72BZSbh010582; Tue, 2 Aug 2016 07:35:28 -0400 To: Ard Biesheuvel , edk2-devel@ml01.01.org, leif.lindholm@linaro.org References: <1470133050-6304-1-git-send-email-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: <16ff0111-3ea6-bb24-6fd4-205356629f9e@redhat.com> Date: Tue, 2 Aug 2016 13:35:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1470133050-6304-1-git-send-email-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 02 Aug 2016 11:35:29 +0000 (UTC) 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 11:35:30 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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