Hi Andrew,
>From your data, it looks the XCode LTO is not enabled correctly for IA32, but 
>correct for X64. Attachment has my build map files, and below are my build 
>commands. FYI.

VS2013x86:
build -a IA32 -t VS2013x86 -p OvmfPkg\OvmfPkgIa32.dsc -n 5 -m 
MdeModulePkg\Core\Pei\PeiMain.inf -b RELEASE
build -a IA32 -t VS2013x86 -p OvmfPkg\OvmfPkgIa32.dsc -n 5 -m 
MdeModulePkg\Core\Pei\PeiMain.inf -b DEBUG -DDEBUG_ON_SERIAL_PORT
build -a X64 -t VS2013x86 -p OvmfPkg\OvmfPkgX64.dsc -n 5 -m 
MdeModulePkg\Core\Dxe\DxeMain.inf  -b RELEASE
build -a X64 -t VS2013x86 -p OvmfPkg\OvmfPkgX64.dsc -n 5 -m 
MdeModulePkg\Core\Dxe\DxeMain.inf  -b DEBUG -DDEBUG_ON_SERIAL_PORT

CLANGLTO38:
build -a IA32 -t CLANGLTO38 -p OvmfPkg/OvmfPkgIa32.dsc -n 5 -m 
MdeModulePkg/Core/Pei/PeiMain.inf  -b RELEASE
build -a IA32 -t CLANGLTO38 -p OvmfPkg/OvmfPkgIa32.dsc -n 5 -m 
MdeModulePkg/Core/Pei/PeiMain.inf  -b DEBUG -DDEBUG_ON_SERIAL_PORT
build -a X64 -t CLANGLTO38 -p OvmfPkg/OvmfPkgX64.dsc -n 5 -m 
MdeModulePkg/Core/Dxe/DxeMain.inf  -b RELEASE
build -a X64 -t CLANGLTO38 -p OvmfPkg/OvmfPkgX64.dsc -n 5 -m 
MdeModulePkg/Core/Dxe/DxeMain.inf  -b DEBUG -DDEBUG_ON_SERIAL_PORT



Steven Shi
Intel\SSG\STO\UEFI Firmware

Tel: +86 021-61166522
iNet: 821-6522

From: af...@apple.com [mailto:af...@apple.com]
Sent: Wednesday, May 11, 2016 2:03 AM
To: Shi, Steven <steven....@intel.com>
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] edk2 llvm branch


On May 10, 2016, at 8:05 AM, Shi, Steven 
<steven....@intel.com<mailto:steven....@intel.com>> wrote:

Hi Andrew,
Thank you for the suggestion. I will try your suggestion and response other 
questions in your email later. I don't have XCODE5 environment, but could do me 
a favor and  let me know what current XCODE5 code size for PeiCore.efi and 
DxeCore.efi in your side? In my side, as below data show, I see the LTO can 
bring big code size improvement which is quite important for firmware in many 
scenarios.

I forgot to mention. LTO or not it is good to check to make sure the assembly 
files are getting dead stripped. For example check to make sure you are not 
getting all the assembly functions in the BaseLib included in your executable.  
Some of the assembly is .S and some is .nasm so you may see different behavior 
depending on which assembler was used.

It is also useful to start looking at the smallest PEIM/DXE drivers 1st as it 
may be easier to spot what is different.


Maybe it is also a good idea to enable LTO in XCODE.

For Xcode you add -object_path_lto $(DEST_DIR_DEBUG)/$(BASE_NAME).lto to   
*_XCODE5_*_DLINK_FLAGS. This places the intermediate link code gen in the 
Build/ director vs. a temp director and is important for source level 
debugging. To turn LTO on and off you add -flto to *_XCODE5_*_CC_FLAGS .

We ended up making LTO a configurable build option, so we control it in the DSC 
file. git

[BuildOptions]
!if $(PEI_LTO_ENABLE)
  XCODE:*_*_IA32_PLATFORM_FLAGS = -flto
!endif

!if $(DXE_LTO_ENABLE)
  XCODE:*_*_X64_PLATFORM_FLAGS = -flto
!endif

I included the Xcode 6.3.2 Numbers:




IA32 DEBUG PeiCore.efi on Ovmf build code size example:
ToolChainName                      PeiCore.efi file size
VS2013x86:                                         40KB
CLANGLTO38:                                    42KB
Xcode                                                      61K


GCCLTO53:                                          44KB
GCC49:                                                  55KB
CLANG38:                                            60KB


IA32 RELEASE PeiCore.efi on Ovmf build code size example:
ToolChainName                      PeiCore.efi file size
VS2013x86:                                         20KB
GCCLTO53:                                          23KB
CLANGLTO38:                                    24KB
Xcode                            31K



GCC49:                                27KB
Clang38:                               29KB


X64 DEBUG DxeCore.efi on Ovmf build code size example:
ToolChainName                      .efi file size                  LZMA 
Compressed size
VS2013x86:                                          137KB                       
 57KB
CLANGLTO38:                                    145KB                        61KB
Xcode                            157K              68K


GCCLTO53:                                          161KB                        
63KB
GCC49:                                273KB                        69KB
CLANG38:                                            205KB                       
 72KB



X64 RELEASE DxeCore.efi on Ovmf build code size example:
ToolChainName                      .efi file size                  LZMA 
Compressed size
VS2013x86:                                         95KB                         
 44KB
GCCLTO53:                                          101KB                        
46KB
CLANGLTO38:                                    107KB                        48KB
Xcode                            104K              49K


GCC49:                                184KB                        52KB
CLANG38:                                            133KB                       
 53KB


Can you send my linker map files for VS2013 & CLANGLTO38 off list.

Thanks,

Andrew Fish


Steven Shi
Intel\SSG\STO\UEFI Firmware

Tel: +86 021-61166522
iNet: 821-6522

> -----Original Message-----
> From: af...@apple.com<mailto:af...@apple.com> [mailto:af...@apple.com]
> Sent: Tuesday, May 10, 2016 1:12 PM
> To: Shi, Steven <steven....@intel.com<mailto:steven....@intel.com>>
> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Subject: Re: [edk2] edk2 llvm branch
>
>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to