<div dir="ltr">Hi Johan,<div><br></div><div>For things that can be passed via the IR, that's the best way to go.</div><div><br></div><div>For other things, I have run into some similar issues. For example, I have a patch out to pass -ffunction-sections and -fdata-sections to the plugin-opt via clang (D24644).</div><div><br></div><div>There was also a patch proposed by someone else to pass -mllvm internal options to the plugin, which I would also like, but there was disagreement on doing this (D20423).</div><div><br></div><div>But this is a good general question. There are probably other options as you are finding that are typically passed to clang that really need to go to the plugin in the case of ThinLTO (and regular LTO) in order to have an effect. I'm curious to see if others have an opinion on the best way to handle this.</div><div><br></div><div>Teresa</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 5, 2016 at 3:20 AM, Johan Engelen <span dir="ltr"><<a href="mailto:jbc.engelen@gmail.com" target="_blank">jbc.engelen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div>  I am trying to figure out the best way to deal with non-default TargetMachine options when using ThinLTO with the LLVMgold.so plugin. (I'm adding support for ThinLTO to the LDC D compiler)</div><div><br></div><div>Things like the target triple, target CPU and target CPU features, some floating point options like unsafe-fp-math, etc., those are (or can be made) explicit in the IR. Is that the way to go? We currently don't emit some of them in the IR, but I see that Clang does, so perhaps we should just mimic that.</div><div>But some other options are not expressed in IR (e.g. FunctionSections, relocation model).</div><div>I see that I can pass LLVM options to the plugin, so one way is to pass all non-default options as plugin-opt cmdline flags. I can't find code in Clang that does that though.</div><div><br></div><div>Thanks for your advice,</div><div>  Johan</div><div><br></div><div><br></div><div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> 408-460-2413</td></tr></tbody></table></span></div>
</div>