<div dir="ltr">Hi edaqa,<div><br></div><div>You might need to set your TargetOptions before calling selectTarget. E.g.</div><div><br></div><div><font face="monospace, monospace">builder.setTargetOptions(Opts).selectTarget(...);</font></div><div><br></div><div>Or you could just let EngineBuilder call selectTarget for you (which is what the no-argument version of EngineBuilder::create does):</div><div><span style="font-size:12.800000190734863px;font-family:monospace,monospace"><br></span></div><div><span style="font-size:12.800000190734863px;font-family:monospace,monospace">llvm::ExecutionEngine * ee = builder.</span><br></div><div><font face="monospace, monospace"><span style="font-size:12.800000190734863px">        setErrorStr( &errStr ).</span><br style="font-size:12.800000190734863px"><span style="font-size:12.800000190734863px">        setEngineKind( llvm::EngineKind::JIT ).</span><br style="font-size:12.800000190734863px"><span style="font-size:12.800000190734863px">        setTargetOptions( topts ).</span></font></div><div><font face="monospace, monospace">        setMArch(arch).</font></div><div><font face="monospace, monospace">        setMAttrs(mattrs).</font></div><div><font face="monospace, monospace"><span style="font-size:12.800000190734863px">        create(</span><span style="font-size:12.800000190734863px">);</span></font></div><div><br></div><div>If those are still failing, it would be interesting to get the data layout string that you are getting from the ExecutionEngine instance and compare it to what you are expecting.</div><div><br></div><div>Cheers,</div><div>Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 19, 2018 at 1:56 AM, edA-qa mort-ora-y via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Taking one step back, I'm not clear I'm even setting the<br>
triple/DataLayout on the module correctly:<br>
<br>
    module = new llvm::Module( "test", *llvm_context );<br>
    module->setTargetTriple( platform::target->triple );<br>
<br>
Is that enough to create an appropriate DataLayout for the module?  I<br>
don't see anyway to convert a triple to a DataLayout, so I can't call<br>
`setDataLayout`.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 19/04/18 10:44, edA-qa mort-ora-y via llvm-dev wrote:<br>
> I don't know if I'm setting the triple of my execution engine<br>
> correctly.  This is leading to an issue where a struct `{i8,i64}` is not<br>
> getting the same layout as the ABI expects.<br>
><br>
> I setup my engine/module like this:<br>
><br>
>      llvm::SmallVector<std::string,<wbr>2> mattrs;<br>
>      llvm::EngineBuilder builder{ unique_ptr<llvm::Module>(<wbr>module) };<br>
>      llvm::ExecutionEngine * ee = builder.<br>
>         setErrorStr( &errStr ).<br>
>         setEngineKind( llvm::EngineKind::JIT ).<br>
>         setTargetOptions( topts ).<br>
>         create(builder.selectTarget(<br>
> llvm::Triple(llvm::Triple::<wbr>normalize(platform::target-><wbr>triple)), "", "",<br>
> mattrs ));<br>
><br>
>     module->setDataLayout( ee->getDataLayout() );<br>
><br>
> Where `module` is my `llvm::Module` with the generated IR code.<br>
><br>
> I'm using the triple `x86_64-pc-linux-gnu`, the same as clang on the<br>
> machine, but getting different alignments. I'm assuming the above is<br>
> somehow not creating the correct layout. Perhaps there's an ordering issue?<br>
><br>
<br>
-- <br>
edA-qa mort-ora-y  <br>
        <a href="http://mortoray.com/" rel="noreferrer" target="_blank">http://mortoray.com/</a><br>
<br>
Creator of the Leaf language<br>
        <a href="http://leaflang.org/" rel="noreferrer" target="_blank">http://leaflang.org/</a><br>
<br>
Streaming algorithms, AI, and design on Twitch<br>
        <a href="https://www.twitch.tv/mortoray" rel="noreferrer" target="_blank">https://www.twitch.tv/mortoray</a><br>
<br>
Twitter<br>
        edaqa<br>
<br>
<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>