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. As said, this is meant to elicit discussion, so fire away ... Ard Biesheuvel (4): BaseTools: AArch64: conditionally allow page-based PC relative relocations BaseTools: AArch64: use an explicit linker script BaseTools: move ARCHCC_ and PLATFORM_FLAGS to end of GCC command line ArmVirtPkg: ArmVirtQemu: use GCC 'small' C model on AArch64 ArmVirtPkg/ArmVirtQemu.dsc | 2 +- ArmVirtPkg/ArmVirtQemu.fdf | 24 +++++++++++++++++++++--- BaseTools/Conf/tools_def.template | 25 ++++++++++++++----------- BaseTools/Scripts/gcc-aarch64-ld-script | 33 +++++++++++++++++++++++++++++++++ BaseTools/Source/C/GenFw/Elf64Convert.c | 51 +++++++++++++++++++++++++++++++++++++++++---------- 5 files changed, 110 insertions(+), 25 deletions(-) create mode 100644 BaseTools/Scripts/gcc-aarch64-ld-script -- 1.9.1 ------------------------------------------------------------------------------ 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