Re: [edk2] EDK to UDK Porting, Driver Binary increased in Size

Subject: Re: [edk2] EDK to UDK Porting, Driver Binary increased in Size

From: Jordan Justen <>

To: "" <>

Date: 2013-09-13 08:09:52

On Thu, Sep 12, 2013 at 12:18 AM, galla rao  wrote:
> Dear All,
> I ported a OptionRom Code from EDK to UDK and found my .efi output file h=
> increased from ~700k to ~1100k
> Building Code in UDK results in increase in Driver Size, is this how UDK =
> designed?
> Even the obj's have increased in size after compilation.
> Kindly Provide your inputs. Thank you All
> The libs i used from UDK
> BaseMemoryLib
> UefiDriverEntryPoint
> HiiLib
> Certain older EDK calls are replaced with newer UDK calls
> EfiLibAllocateZeroPool=E8 AllocateZeroPool; EfiZeroMem=E8ZeroMem;
> EfiCopyMem=E8CopyMem; EfiSetMem=E8SetMem; EfiLibLookupUnicodeString=E8
> LookupUnicodeString; Sprint=E8UnicodeSprint
>  Introduced
> HiiAllocateOpCodeHandle, HiiCreateCheckBoxOpCode, HiiCreateTextOpCode,
> HiiCreateOneOfOptionOpCode, HiiUpdateForm, HiiCreateGuidOpCode
> Inplace of CreateOneOfOpCode, IfrLibUpdateForm, EFI_HII_UPDATE_DATA
> Compiler Flags
> MSFT:*_*_X64_CC_FLAGS =3D /nologo /c /WX- /GS- /X /W3 /Gs8192 /D /Zc:wcha=
> /D UNICODE  /Gy /FIAutoGen.h /EHs-c- /GR- /GF
> Linker flags
> /IGNORE:4254  /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D
> /MERGE:.rdata=3D.text

Did you actually change the CC/LINK flags? I don't think that is
commonly needed for achieving good sizes.

I think the RELEASE flags in the standard tools_def should work pretty
well ... except one thing ... :)

... DebugLib can add a lot of size. Something like this in your .dsc
might help for release builds.


Although, I thought MSVC usually did pretty good at removing dead code
at link time. So, you might check your
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel and
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask settings in your .dsc.

Also, you might also look at the LibraryClasses settings in your .dsc.


How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
edk2-devel mailing list