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 <jljusten@gmail.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

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=
as
> increased from ~700k to ~1100k
>
> Building Code in UDK results in increase in Driver Size, is this how UDK =
is
> 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=
r_t-
> /D UNICODE  /Gy /FIAutoGen.h /EHs-c- /GR- /GF
>
> Linker flags
> RELEASE_VS2010x86_X64_DLINK_FLAGS  =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001
> /IGNORE:4254  /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D
> /Machine:X64  /DLL /ENTRY:$(IMAGE_ENTRY_POINT)
> /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER  /BASE:0 /DRIVER /MERGE:.data=3D.text
> /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.

[BuildOptions]
  GCC:RELEASE_*_*_CC_FLAGS             =3D -DMDEPKG_NDEBUG
  INTEL:RELEASE_*_*_CC_FLAGS           =3D /D MDEPKG_NDEBUG
  MSFT:RELEASE_*_*_CC_FLAGS            =3D /D MDEPKG_NDEBUG

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.

-Jordan

---------------------------------------------------------------------------=
---
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
http://pubads.g.doubleclick.net/gampad/clk?id=3D51271111&iu=3D/4140/ostg.cl=
ktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel