<div dir="ltr">Hi Mehdi,<div><br></div><div>yes, on Linux we do 2-stage build exactly for this reason.</div><div>For the reference, the code is <a href="https://cs.chromium.org/chromium/src/tools/clang/scripts/update.py?q=update.py&sq=package:chromium&dr=C&l=564">https://cs.chromium.org/chromium/src/tools/clang/scripts/update.py?q=update.py&sq=package:chromium&dr=C&l=564</a> and we don't make use of <span style="font-size:12.8px">LLVM_ENABLE_LTO at the moment (no good reason I can think of)</span></div><div><br></div><div>krasin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 22, 2016 at 9:26 AM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div class="h5"><blockquote type="cite"><div>On Sep 22, 2016, at 9:19 AM, Hans Wennborg <<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>> wrote:</div><br class="m_7292252730275314171Apple-interchange-newline"><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">On Thu, Sep 22, 2016 at 9:09 AM, Mehdi Amini <</span><a href="mailto:mehdi.amini@apple.com" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">mehdi.amini@apple.com</a><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">> wrote:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>On Sep 22, 2016, at 8:58 AM, Hans Wennborg <<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>> wrote:<br><br>On Thu, Sep 22, 2016 at 12:51 AM, Sylvestre Ledru via cfe-dev<br><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br><br>Le 22/09/2016 à 03:33, Mehdi Amini a écrit :<br><br>Hi,<br><br>I was wondering the same thing recently and Hans pointed me to<br>llvm/utils/release.<br><br>It turns out we’re not using LTO :(<br>(Neither PGO…)<br><br>In the Debian/Ubuntu packages (and this is general to packaging), we are:<br>* relying on the build system of the application itself<br>* adding some flags like "-g -O2" and the fortify options<br><a href="https://wiki.debian.org/Hardening" target="_blank">https://wiki.debian.org/<wbr>Hardening</a><br><br>For the linker, for the LLVM toolchain, it depends if the version of<br>binutils in the distro has it or not (at least 2.23.1-1~exp3).<br>Here, for the Debian & Ubuntu packages, I am using binutils gold but not<br>sure the LTO option is set to the llvm build system?!<br><br>However, happy to try that (I think this should be part of the build system,<br>at least for LTO).<br><br><br>I think that's what the -LLVM_ENABLE_LTO={Full,Thin} option is for,<br>but it's not enabled by default.<br><br><br>So, what about changing this?<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I don't know how practical it would be at the moment. Would most build</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">environments support it? It seems to assume Clang is being built by</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Clang, and that the gold plugin (which I think requires the binutils</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">headers to build) is around.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div></blockquote><div><br></div></div></div><div>Aren’t you doing a 2-stage build? In which case the stage-2 always has clang available.</div><div>It requires Gold on linux probably, but on OSX the system linker supports LTO.</div><div><br></div><div>At minima the OSX build could have it enabled without risk of failure.</div><div><br></div><div>— </div><span class="HOEnZb"><font color="#888888"><div>Mehdi</div><div><br></div><div><br></div></font></span></div></div></blockquote></div><br></div>