[PATCH] Enable building LTO on WIN32

Greg_Bedwell at sn.scee.net Greg_Bedwell at sn.scee.net
Tue Oct 1 13:45:39 PDT 2013

Right... Let's try that again!

So my last patch was reverted for breaking the build (sorry!).   I tracked 
down the problem to affecting builds through Ninja only.  The problem came 
down to the fact that I was specifying the def file option to the linker 
for the whole LTO CMake file.  On the Visual Studio and MinGW builds this 
was fine because the linker is used to build the DLL and the lib tool is 
used to create LTO_static so CMake was adding the def file to the DLL 
build only as expected.  The difference is that when building with Ninja 
the linker is used for both steps, with '/lib' specified for LTO_static to 
invoke the lib tool indirectly.   This difference meant that CMake was 
adding the def file to both the DLL and LTO_static builds, but it was 
clearly only valid for the DLL.  I've modified my change to now explicitly 
only add the def file to the DLL build.

I've tested the Windows build with VS2010, VS2012, Ninja and MinGW so 
hopefully I've covered all my bases now...

Here's my updated patch.  All feedback welcomed. 



(BTW Ninja does seem really nice and fast, so all the future hours I save 
waiting for MSVC to do its thing is one big positive to come out of this 

Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote on 30/09/2013 

> From: Rafael EspĂ­ndola <rafael.espindola at gmail.com>
> To: Greg_Bedwell at sn.scee.net
> Cc: llvm-commits <llvm-commits at cs.uiuc.edu>
> Date: 30/09/2013 16:32
> Subject: Re: [PATCH] Enable building LTO on WIN32
> On 30 September 2013 10:57,  <Greg_Bedwell at sn.scee.net> wrote:
> >> We should switch to in source annotations at some point, but we 
> >> do so for windows and ELF/MachO at the same time. Using the .def for
> >> now is OK.
> >>
> >
> > Thanks.  I agree with this entirely.
> >
> >> Patch LGTM.
> >
> > Please can you commit for me?  I'm still working towards commit 
access. Do
> > you want me to rebase against top of trunk?
> r191670. Thanks.
> Cheers,
> Rafael

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. 
If you have received this email in error please notify postmaster at scee.net
This footnote also confirms that this email message has been checked for 
all known viruses.
Sony Computer Entertainment Europe Limited
Registered Office: 10 Great Marlborough Street, London W1F 7LP, United 
Registered in England: 3277793

P Please consider the environment before printing this e-mail
-------------- next part --------------
A non-text attachment was scrubbed...
Name: enable-LTO-on-Windows-2.patch
Type: application/octet-stream
Size: 2483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131001/b14afb09/attachment.obj>

More information about the llvm-commits mailing list