<div dir="ltr">Hi Tim,<div>Thank you for your answer.</div><div><br><i>We've fairly recently fixed a bug that looks very similar (r238680,<br>which was well after 3.6)</i></div><div><br></div><div>If I wanted to back port that to 3.5 where should I look at? Where in the ARM backend the decision to relax an instruction is taken?</div><div><br></div><i>That's weird. Even with "-filetype=obj" (the bug only occurs when<br>directly writing an object file)? Not that it really affects anything,<br>getting the same backend options with llc can be a bit tricky.<br></i><div><br></div><div>This is passing even with -filetype=obj. The transformation I apply are in the optimizer so I must build the new bc to create the object file. </div><div><i><br></i></div><div>Thanks for your help</div><div><br></div><div>Eric</div><div><br>Le dimanche 5 juillet 2015, Tim Northover <<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>> a écrit :<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Eric,<br>
<br>
On 5 July 2015 at 07:22, Eric Bentura <<a>ebentura@gmail.com</a>> wrote:<br>
> As a result it seems that the generated machine code is incorrect (as of<br>
> LLVM 3.5): The AsmPrinter generates the following instruction :<br>
> adr r2, .LJTI4_0_0<br>
> when going through the MC streamer, I get a "fatal error: error in backend:<br>
> out of range pc-relative fixup" .<br>
<br>
We've fairly recently fixed a bug that looks very similar (r238680,<br>
which was well after 3.6)<br>
<br>
> Apparently, the fixup does not hold in the 12 bits we have available. I<br>
> would have expected clang to perform relaxation on this instruction on that<br>
> particular case.<br>
<br>
Agreed, whatever's going on it's a bug in the ARM backend.<br>
<br>
> Is there a way in the PassManager::runOnFunction to anticipate that so that<br>
> I can generate a IR code that would fit when converted to machine code?<br>
<br>
Not as far as I'm aware; since the bug is further back there's no<br>
reason to try and provide such information to earlier passes. The<br>
backend is expected to cope with whatever you give it.<br>
<br>
> Strangely enough, this is not happening when using llc to generate the code<br>
> from the bc file, I get the object file.<br>
<br>
That's weird. Even with "-filetype=obj" (the bug only occurs when<br>
directly writing an object file)? Not that it really affects anything,<br>
getting the same backend options with llc can be a bit tricky.<br>
<br>
> Even though there have been<br>
> improvements since them, I am concerned with the difference of behavior of<br>
> the two tools.<br>
<br>
The most common one I find perturbing output is "-mcpu" (even with a<br>
triple), but really there are so many options front-ends can twiddle<br>
that you just have to know what it's doing and copy that.<br>
<br>
Cheers.<br>
<br>
Tim.<br>
</blockquote></div>
</div>