From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (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 221871A1E26 for ; Tue, 13 Sep 2016 07:12:38 -0700 (PDT) Received: by mail-it0-x229.google.com with SMTP id n143so39011664ita.1 for ; Tue, 13 Sep 2016 07:12:38 -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=Pmk9puO+UAJHXV/hdzxiLKMD2lVV160688xi4Asa6n4=; b=U+3EDe1oe3Vopwawn4wUD/05J0/xsdgfu6utyME70EBel43A/jm9mC9Fq4iONnXdV2 uSWJ+on5aoW6Rb/lKV421394o+Z5UgJ2riLH85Py+MU2KfoZQNPFuKp6nnVL2wfbdO/p wdZ2BaY4uVz6yZNeZy6d4Nq6LNq0pZPLmG28Q= 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=Pmk9puO+UAJHXV/hdzxiLKMD2lVV160688xi4Asa6n4=; b=LzPeaMWhshj8c1j8k3bZaaRapYdZy+g/a2/8mgZd9AM4bgREFMwev1GxBxJ2wehGPD 9+4m8mLiDt1OmoyIYSVhsReggPTjrdF/LI2lC06ykwi1HHLEzK2UgmOzWSvtRYjroDtY YgQjqxjfLfqaZsBX5CQW4yOhY7LabTqi5IXqMbQKQXWELA8+OxMHL5LeMx5/p+DJGgdn iWGrC74wTUGHgboA/OWZ/2XjmPj9aUhMtFln5V9qY41RXyzcPXDcYwyyXvIfmhS+Bx38 IRD7wAlbCkQUXwfKaxZx/zyYltPM5AVsBCTZINRE3GzvdMjRbk0KXPgmFGDB/V3u6MUd cdpA== X-Gm-Message-State: AE9vXwMyQIMVPzVj5gPmFh2CbWdGUaH1bLcB1/XohZr87g9B5bi6BgCSPogey2r8H8ckKIbmg5LcSnwaO97/VWOD X-Received: by 10.107.16.226 with SMTP id 95mr1955386ioq.41.1473775957342; Tue, 13 Sep 2016 07:12:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.204.195 with HTTP; Tue, 13 Sep 2016 07:12:36 -0700 (PDT) In-Reply-To: <20160913140236.GC540@e102648.cambridge.arm.com> References: <20160913140236.GC540@e102648.cambridge.arm.com> From: Ard Biesheuvel Date: Tue, 13 Sep 2016 15:12:36 +0100 Message-ID: To: Achin Gupta Cc: edk2-devel-01 Subject: Re: Relocation fixup during AARCH64 SEC PE-COFF generation? 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, 13 Sep 2016 14:12:38 -0000 Content-Type: text/plain; charset=UTF-8 On 13 September 2016 at 15:03, Achin Gupta wrote: > Hi All, > > Upon entry into UEFI, the ArmPlatformPkg/PrePi/PeiUniCore.inf SEC module > executes directly from within the firmware volume. The FV would typically be > loaded in DRAM by ARM Trusted Firmware. The rule in ArmJuno.fdf for SEC file > types converts a PE-COFF module into a stripped Terse executable as follows: > > [Rule.AARCH64.SEC] > FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED FIXED { > TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi > } > > The GCC_ARM_AARCH64_DLINK_COMMON variable includes the "--emit-relocs" option > when the ELF image is generated. Since the SEC module is able to "XIP" from the > within FV, this means that the relocations have to be fixed up at link time > before the TE image is created. > Correct. GenFv relocates the image based on the runtime address of the firmware volume. > It seems to me that in GenFw.c, at least the static relocations are fixed up > when an ELF image is converted to PE-COFF. Can someone confirm if I am correct > in understanding that dynamic relocations will be left as is in the PE-COFF > image while static relocations will be fixed up? > We usually don't emit dynamic relocations, since we are not linking shared objects.