Hello Scott,
It’s a pity I can’t repeat this because it is for Windows while I work in Mac.
I think I correctly apply the patch and try to compile ShellPkg.
Without LTO I have full success.
Adding into Shell.inf  lines
----
[BuildOptions]
  GCC:*_*_*_CC_FLAGS = -Os -flto 
——
I got the error
———
ApplicationEntryPoint.c:(.text._ModuleEntryPoint+0x4): undefined reference to 
`_gUefiDriverRevision'
ApplicationEntryPoint.c:(.text._ModuleEntryPoint+0x31): undefined reference to 
`ProcessLibraryConstructorList'
ApplicationEntryPoint.c:(.text._ModuleEntryPoint+0x43): undefined reference to 
`ProcessModuleEntryPointList'
ApplicationEntryPoint.c:(.text._ModuleEntryPoint+0x58): undefined reference to 
`ProcessLibraryDestructorList'
collect2: error: ld returned 1 exit status
———
So these symbols are optimized away and it looks like an idea of AutoGen.c file

Sergey

On 08 нояб. 2014 г., at 0:48, Scott Duplichan <sc...@notabs.org> wrote:

> Hello Sergey,
>  
> How about trying a sample build environment: get file gcc-lto.7z from 
> http://notabs.org/uefi/tmp/
>  
> The archive was built this way:
> 1) Get standard EDK2
> 2) Apply the patch from 
> here:http://sourceforge.net/projects/edk2developertoolsforwindows/files/Patches/Link%20Time%20Optimization/
> 3) Run build-python.bat to rebuild build.exe.
What it will be in Unix system?


> 4) Run build.bat > buildlog.txt 2>&1
>  
> The result is shell.efi for IA32, X64, and AARCH64 built with GCC49 LTO.
>  
> Unzip the archive and run build.bat. All 3 shell builds should complete.
>  
> I deleted the build directory and other temps to reduce archive size. 
> Compilers and all other required build tools are included.
>  
> Thanks,
> Scott
>  
> From: Sergey Isakov [mailto:isakov...@bk.ru] 
> Sent: Friday, November 07, 2014 01:52 PM
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] Status of gcc link time optimization for EDK2 use
>  
> Comments online
>  
> On 07 нояб. 2014 г., at 22:20, Jordan Justen <jordan.l.jus...@intel.com> 
> wrote:
> 
> 
> On 2014-11-07 07:33:24, Scott Duplichan wrote:
> 
> The summary of the 4 changes needed is not detailed enough for easy
> application. Instead, apply this patch:
> 
> http://sourceforge.net/projects/edk2developertoolsforwindows/files/Patches/
> Link%20Time%20Optimization/
> Even with these patches I can’t compile with -flto.
> /Users/sergey/src/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c:48:
>  undefined reference to `_gUefiDriverRevision'
> /Users/sergey/src/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c:60:
>  undefined reference to `ProcessLibraryConstructorList'
> /Users/sergey/src/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c:65:
>  undefined reference to `ProcessModuleEntryPointList'
> /Users/sergey/src/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c:70:
>  undefined reference to `ProcessLibraryDestructorList'
> collect2: error: ld returned 1 exit status
> These symbols stripped?
> 
> 
> 
> Patches should be contributed using the process documented in
> BaseTools/Contributions.txt. Otherwise, we cannot use the
> contribution.
> 
> The work looks promising though! :)
> 
> Other feedback: What is up with all the environment variables? It
> seems to be to allow GCC49 to be used with/without lto...
> 
> Instead, I think we should do one of these:
> * Convert GCC49 to LTO only
> * Wait for GCC50 to enable LTO
> * Add GCC49LTO
> I think it may be like conditional compilation
> ./build.sh -D WITH_LTO
> By default no.
> 
> 
> 
> -Jordan
> 
> 
> From: Sergey Isakov [mailto:isakov...@bk.ru]
> Sent: Friday, November 07, 2014 07:06 AM
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] Status of gcc link time optimization for EDK2 use
> 
> 
> 
> It is very interesting and I hope someone can apply this to EDK2. I failed.
> 
> I created gcc-4.9.2 for linux-gnu target with --enable-plugin. And binutils
> with --enable-plugins. Success.
> 
> But option -flto brakes building. 
> 
> This advice
> 
> ---------
> 
> 2) Use gcc to launch the ld instead of invoking ld directly
> 
> -----------
> 
> failed because of build options for ld
> 
> -----
> 
> x86_64-linux-gnu-gcc: error: unrecognized command line option '-Map'
> 
> x86_64-linux-gnu-gcc: error: unrecognized command line option '-melf_x86_64'
> 
> x86_64-linux-gnu-gcc: error: unrecognized command line option '--oformat=
> elf64-x86-64'
> 
> x86_64-linux-gnu-gcc: error: unrecognized command line option '-('
> 
> -----
> 
> and so on.
> 
> Using ld I got another problems like  error adding symbols: Bad value
> 
> As well as losing _ModuleEntryPoint or .text section at all.
> 
> 
> 
> I pass waiting for a good news.
> 
> 
> 
> 
> 
> 
> 
> On 07.11.2014, at 9:05, Scott Duplichan wrote:
> 
> 
> 
>    http://notabs.org/uefi/gcc-lto.htm
> 
>    Thanks,
>    Scott
> 
> 
>    
> ------------------------------------------------------------------------------
>    _______________________________________________
>    edk2-devel mailing list
>    edk2-devel@lists.sourceforge.net
>    https://lists.sourceforge.net/lists/listinfo/edk2-devel
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>  
> ------------------------------------------------------------------------------
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to