On 23 June 2015 at 17:30, Ard Biesheuvel <ard.biesheu...@linaro.org> wrote: > Hello all, > > This is an RFC series to elicit discussion regarding the use of linker script, > and the fact that we use the somewhat obscure 'large' C model for building > EDK2 for AArch64. > > Some observations that brought about this series: > - the -Ttext=0x0 LD command line option appears to have no beneficial effect > - the builtin LD script that we have been using so far prevents .text and > .data > from sharing any 64 KB page frames; this is intentional since .text and > .data > are typically mapped with different permissions when executing under an OS, > and the maximum page size on AArch64 is 64 KB; > - we have been using the 'large' C model, which may be suboptimal > - the Property Table support in UEFI 2.5 requires the use of an explicit > linker > script so that sections are 4 KB aligned, and .text and .data are guaranteed > not to share a 4 KB page frame, again for allowing them to be mapped with > different permissions. This maps poorly onto AArch64, again due to its > maximum > page size of 64 KB. > > These patches propose a linker script to be used with AArch64 that preserves > the > layout between ELF and PE/COFF, i.e., the placement of .text and .data is the > same for both binaries. It also places .text such that ADRP based PC relative > symbol references can be supported, provided that the PE/COFF binaries are > always loaded at a 4 KB aligned offset. >
A quick survey with the .efi binaries generated during the ArmVirtQemu build shows that these changes eliminate 80% of the runtime relocations. Total size savings are only 68 KB, but I suppose there is a runtime benefit as well to not having to do the fixups. It would indeed be quite useful to be able to specify different build options per module type, so that we can have different linker scripts and C models for XIP, normal and runtime modules. -- Ard. ------------------------------------------------------------------------------ Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical & virtual servers, alerts via email & sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel