From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eu-smtp-delivery-143.mimecast.com (eu-smtp-delivery-143.mimecast.com [207.82.80.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0AFC91A1E0B for ; Tue, 13 Sep 2016 08:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LXqYZXMHBn1MLN4y7wR+UzQPAWy9UU0icpaVPEPKZDQ=; b=VjKPvHEhdtW6AAasZ41hpLqaXl/XO/64nCrgeNaSiCjrqZfDLg6Mmjrrs5qMnBvioDyitRrCF4GSaKEfaXbXhLiTjiSNlDVHJUl6pCJPyVj+otgMdzGHLNz9095qJngHlPK6FhlC/YigNt8VvP8CzKfEXEudMhAHjFVigsJ43Oc= Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01lp0240.outbound.protection.outlook.com [213.199.154.240]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-50-VRqM2j33NiCPxyrHWh7CfQ-1; Tue, 13 Sep 2016 16:15:29 +0100 Received: from e102648.cambridge.arm.com (217.140.96.140) by DB5PR08MB1190.eurprd08.prod.outlook.com (10.166.174.147) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.619.10; Tue, 13 Sep 2016 15:15:27 +0000 Date: Tue, 13 Sep 2016 16:16:17 +0100 From: Achin Gupta To: Ard Biesheuvel CC: edk2-devel-01 Message-ID: <20160913151543.GE540@e102648.cambridge.arm.com> References: <20160913140236.GC540@e102648.cambridge.arm.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: DB6PR0601CA0028.eurprd06.prod.outlook.com (10.169.209.14) To DB5PR08MB1190.eurprd08.prod.outlook.com (10.166.174.147) X-MS-Office365-Filtering-Correlation-Id: 189045ce-d92c-4e78-677e-08d3dbe8cb52 X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB1190; 2:HZ0u4ihn7f1rM66c3pfhf2fUnISIOr7PSqsaiSTfqL0my2cegJtP/hSn/Sgo7ziJ8+D2HLRoao6qVKU0qEEXhMGg341pXzlyUm7DzQNVQbSJ1kkFmGu/RFg3GnVyziMQVZCjZddFS27wv3mjCHecRIdjt3hZ0wNm5Vwydx06y/u0DyAR+fUo+lyrwzB0A2qi; 3:qvT8tQd5Nf1zk9YHalXghxSIMO8wJRhnU0eifdHEZt3ejh7EFIwkQqPq+J++bEm8Jyl2ErFxa3SKAU/Ng7BhnJTNqlOifP6Yi8f1E/Aj+rlf/qJ42+q+fyUT98k36MV5 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR08MB1190; X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB1190; 25:PalYyUaeBGXkrnb+KQo+QFaCqfJE12xYhcQKrSeH2G+/KDkgfHXJ8lvrkQyaySrBF+MfrLsadwzRTjElnwqhqU3fnoSwLlfwGBsmS7HjTH7j5vLAVbJWwoXR+TQ4sEnypv6tLpAmlgdyycPn0hfruHVQkcDgRrlPvUWji0kmqoioD5eXOIu1MiQ1yZrWhZmkvcb21zx4ejAsgIETRy6eVpbJQ+kUYosAuuWz8loYRsYlzBsypgC+bCZDnJGDik/bj+yn3S4oAji9uFwD+Y/THUkTQI3QCA6LD/0z4V9Jr1kS7NyS2xQ6C4x+vw7wRsbUP0Dfb4ds+1L6hBiLcnnI4XqDFzs4q5+ekmWVWg6YdmWq4aE7B44PLTc1yU+ggH8dZPj2NuR0k9/5Z7J2NYG6v4bwWntpuHSgGlZz3iNdor+E5nakVnco5o3aXOaZvDdH+aTDkkVdr1c2NIQb5nDZdioHusfO8wrbjGHMfMveO9k+RgzCv69V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BVbl9/4SYUTmb0ZbC2QATJ2rd4RfVJH4u+oI98Q1yetXe0YR9nscpWJRoeFVELcKftt45+J2H9SFTlhoWHElkQ1j0ZlIt0rO7PxyABNzD5AHiIWpWNxFfQAcO7FR/hEW4NxFZPe2E5CSo5dKnHRPBrG8z0//eZ9U9+Ff/AvEXMkQnTW1Hd5kXhmNaizuvt/j9lwFyAtbgb2te0GbwLLiohGzSwrn3keoeuSmA/AZDg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:DB5PR08MB1190; BCL:0; PCL:0; RULEID:; SRVR:DB5PR08MB1190; X-Forefront-PRVS: 0064B3273C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(53754006)(40434004)(199003)(189002)(24454002)(76176999)(54356999)(110136003)(4001350100001)(19580395003)(86362001)(19580405001)(97736004)(50986999)(101416001)(105586002)(106356001)(189998001)(1076002)(97756001)(42186005)(6116002)(23726003)(3846002)(81156014)(81166006)(68736007)(586003)(33656002)(2950100001)(77096005)(8746002)(92566002)(305945005)(2906002)(8676002)(7846002)(7736002)(50466002)(5660300001)(47776003)(46406003)(5890100001)(4326007)(66066001)(83506001)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR08MB1190; H:e102648.cambridge.arm.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB5PR08MB1190; 23:iUTWB8jdcMF5jNBwxZJ6xIzdVELiEj27CPUPiPqUR?= =?us-ascii?Q?xz9qtAGPJXf0zj3EiQZmG4RDJhY3vxSq5syz4WFtYlp00uSTXKIA8EB9hfCe?= =?us-ascii?Q?K86AAkgIfZfyVsgKhvtlZhNBgNlLZ47cg4GktzFx24w/HymcJN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nZYAFWK009QiojlU5JlfQgSDAJmZmsrJ4Xf+5XNhn9PJySZl3TBOMGFgRIL5nj4JvRG7lP7tb6K1XjmzSyZNK0CKEvtuJ0WHkN0LIWSq04RYrj5TPW/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB1190; 20:biJbaxzz8juyLxOWJ+0U4sJ8FEMLAxxDTaC/Q4DkG5p32F4s7oB93JfUgXKrMZWk25SPeP9J2AM8f2Fk5uR1XY7CWK8tjjcZAsils613U0HrnNWKmpaJBxP3pOO/kl+SCY/np6R5AlSm0c0RN+LcpHy3vsYHWrh621gs0auLh58= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2016 15:15:27.8271 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB1190 X-MC-Unique: VRqM2j33NiCPxyrHWh7CfQ-1 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 15:15:35 -0000 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tue, Sep 13, 2016 at 03:43:41PM +0100, Ard Biesheuvel wrote: > On 13 September 2016 at 15:12, Ard Biesheuvel = wrote: > > On 13 September 2016 at 15:03, Achin Gupta wrote: > >> Hi All, > >> > >> Upon entry into UEFI, the ArmPlatformPkg/PrePi/PeiUniCore.inf SEC modu= le > >> executes directly from within the firmware volume. The FV would typica= lly be > >> loaded in DRAM by ARM Trusted Firmware. The rule in ArmJuno.fdf for SE= C file > >> types converts a PE-COFF module into a stripped Terse executable as fo= llows: > >> > >> [Rule.AARCH64.SEC] > >> FILE SEC =3D $(NAMED_GUID) RELOCS_STRIPPED FIXED { > >> TE TE Align =3D 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 fi= xed 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. > > ... or more specifically, all absolute static relocations are > converted into PE/COFF base relocations, all relative static > relocations are validated against the PE/COFF layout (which we keep > 1:1 identical with the ELF section layout), and all dynamic > relocations are ignored. Thanks Ard. I expect the relative static relocations to be fixed by the PE-= COFF loader at runtime. > Note that this implies that proxy generating > static relocations are rejected, since --emit-relocs does not produce > any output for the proxies. You lost me here. What do you mean by "proxy generating static relocations"= ? cheers, Achin IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.