The AARCH64 GCC builds use the GCC large code model by default, simply because it is the code model that requires the least amount of hacking to produce code that supports the PE/COFF conversion applied by Tianocore.
However, it is suboptimal in more than one way: - each symbol reference requires a PC-relative literal load (to obtain the address of the memory location that stores the address of the symbol) and 8 bytes to store the address itself, so it uses more space than necessary; - loading the symbol address may stall on the D-cache - each symbol address is an absolute address which requires fixing up by the PE/COFF loader - the large model is not recommended by the GCC developers, and not used very widely so it does not receive a lot of testing coverage. Now that we can support relative AARCH64 relocations, we can actually switch to the GCC tiny code model, which does away with the literals, and simply uses PC-relative references to refer to the symbol directly. This does impose a 1 MB size limit on modules, but this limit is exceeded only very rarely, and we can work around it by switching to the small or large model in that case. Patch #1 overrides the BuildOptions for the DEBUG Shell build to use the small model, since its size exceeds the 1 MB limit. Patch #2 sets the AARCH64 code model to 'tiny' by default. For the ArmVirtQemu AARCH64 RELEASE build, the size reduction is 10% before compression, 3% after compression, with the number of PE/COFF fixups reduced by 80% (see below for details) Ard Biesheuvel (2): ShellPkg: force use of AARCH64 small model when building DEBUG shell BaseTools AARCH64: use tiny code model by default BaseTools/Conf/tools_def.template | 2 +- ShellPkg/Application/Shell/Shell.inf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel