<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 31, 2016, at 10:06 AM, Teresa Johnson <<a href="mailto:tejohnson@google.com" class="">tejohnson@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, May 31, 2016 at 10:02 AM, Mehdi Amini<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" class="">mehdi.amini@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><span class="gmail-"><blockquote type="cite" class=""><div class="">On May 31, 2016, at 10:00 AM, Teresa Johnson <<a href="mailto:tejohnson@google.com" class="">tejohnson@google.com</a>> wrote:</div><br class=""><div class=""><br class=""><br style="font-family: helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="gmail_quote" style="font-family: helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">On Tue, May 31, 2016 at 9:47 AM, Mehdi Amini<span class=""> </span><span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" class="">mehdi.amini@apple.com</a>></span><span class=""> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On May 31, 2016, at 9:42 AM, Teresa Johnson <<a href="mailto:tejohnson@google.com" class="">tejohnson@google.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 24, 2016 at 4:01 PM, Duncan P. N. Exon Smith<span class=""> </span><span dir="ltr" class=""><<a href="mailto:dexonsmith@apple.com" class="">dexonsmith@apple.com</a>></span><span class=""> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">This seems strange to me.  For example, it breaks the otherwise very convenient:<br class="">--<br class="">$ clang -flto t.c -mllvm -some-internal-option-for-cc1<br class="">--<br class=""></blockquote><div class=""><br class=""></div><div class="">What is an example mllvm option that is passed to cc1 that would be illegal to pass via the gold-plugin - it isn't just ignored?</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">I believe it is not about being "illegal" but rather being surprised by some unintended behavior, and losing the ability to control what options is applied during link compared to the cc1-optimizations phase.</div></div></div></blockquote><div class=""><br class=""></div><div class="">But if I did a vanilla -O2 build and passed -mllvm it would be passed down to the optimization pipeline. I find the reverse (it isn't when I do -O2 -flto) more surprising.</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><br class="">I don't understand how it's better.<br class=""></blockquote><div class=""><br class=""></div><div class="">Another issue with the current situation is that in order to pass these to llvm in LTO builds (at least for gold) you have to do -Wl,-plugin-opt,-mllvm,-some-option, and gold gives a fatal error if it sees a -plugin-opt without -plugin. So for example in a clang LTO bootstrap I cannot set it up to pass any -mllvm option via plugin-opt because there are link steps that create intermediate shared libraries but don't invoke the plugin, so I get a fatal error (this affects all plugin-opt, but -mllvm is probably a likely one that I would want to pass for debugging or analysis).</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">I'm surprised that you are building intermediate shared library during a bootstrap of clang, and even more that they're not built out of bitcode?</div></div></div></blockquote><div class=""><br class=""></div><div class="">Looks like it is compiler-rt asan code (<a href="http://libclang_rt.asan-i386.so/" class="">libclang_rt.asan-i386.so</a>) that is not being built with LTO, which I think makes sense given that it is linked into user code not into the compiler.</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">I didn't mean to have a .so that is itself bitcode (that should never happens: it does not make sense), but rather that the .so is built out of bitcode files.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Confirmed that the compiler-rt files are native .o files -  Do I need to do something special to get LLVM_ENABLE_LTO to apply to compiler-rt?</div></div></div></blockquote><div><br class=""></div><div>It could be just a deficiency of the cmake configuration for LLVM_ENABLE_LTO.</div><div><br class=""></div><div>You can always not use this flag and instead do something like: -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-flto"  -DCMAKE_CXX_FLAGS="-flto"</div><div><br class=""></div></div>-- <div class="">Mehdi</div><div class=""><br class=""></div></body></html>