29.7.1 Performance considerations for data types
Avoid declaration and initialization of variables or structures that contain native length data types such as
INTN
, UINTN
, and pointers. One of the issues with initializing variables occurs during optimization. If variables are initialized statically, the compiler optimizes them for size and, for example, gives the variable a 32-bit placement or a 16-bit placement. This can create problems if the variables are a size that is different on different CPU architectures.TIP: Initialize variables separately from declaring them.
The amount of variable initialization that is performed during EBC runtime initialization can be determined by viewing the PE/COFF sections of a UEFI Driver compiled for EBC. The linker provided with Microsoft* tools provides a method to perform this operation.
The command is:
link -dump -headers <filename>
. This command dumps the different parts of an .EFI file. The goal is to minimize the VARBSS section while maximizing the .data and .rdata sections of the PE/COFF image.Last modified 2yr ago