<div dir="ltr">Hi Dimitry, Reid,<div><br></div><div>I've added stack realignment code to the i386 resolver function in r261503. This should fix the failures due to the fxsave/fxrstor instructions. Hopefully this will fix the BSD bots.</div><div><br></div><div>Reid - this doesn't address the relocation issue you encountered, so we can't turn these tests back on on Windows yet, but it's a step in the right direction.</div><div><br></div><div>Cheers,</div><div>Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 21, 2016 at 12:20 PM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@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 Dimitry,<div><br></div><div>This looks similar to the issue that Reid ran in to. I suspect it's a stack alignment issue: This code assumes the stack is 16-byte aligned, and I guess that's not true on Windows or BSD.</div><div><br></div><div>I'll add some stack realignment code now and see if it gets the builders green again.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 21, 2016 at 5:42 AM, Dimitry Andric <span dir="ltr"><<a href="mailto:dimitry@andric.com" target="_blank">dimitry@andric.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 10 Feb 2016, at 02:02, Lang Hames via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: lhames<br>
> Date: Tue Feb  9 19:02:33 2016<br>
> New Revision: 260338<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=260338&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=260338&view=rev</a><br>
> Log:<br>
> [Orc] Add lazy-JITting support for i386.<br>
><br>
> This patch adds a new class, OrcI386, which contains the hooks needed to<br>
> support lazy-JITing on i386 (currently only for Pentium 2 or above, as the JIT<br>
> re-entry code uses the FXSAVE/FXRSTOR instructions).<br>
><br>
> Support for i386 is enabled in the LLI lazy JIT and the Orc C API, and<br>
> regression and unit tests are enabled for this architecture.<br>
<br>
</span>Hi,<br>
<br>
I was wondering why I was always getting OrcLazy test failures on i386-freebsd recently, but it appears to have been introduced with this commit. :)<br>
<br>
All the OrcLazy tests result in lli getting a SIGBUS:<br>
<br>
FAIL: LLVM :: ExecutionEngine/OrcLazy/anonymous_globals.ll (18054 of 25776)<br>
******************** TEST 'LLVM :: ExecutionEngine/OrcLazy/anonymous_globals.ll' FAILED ********************<br>
Script:<br>
--<br>
/home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/./bin/lli -jit-kind=orc-lazy /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/anonymous_globals.ll<br>
--<br>
Exit Code: 138<br>
<br>
Command Output (stderr):<br>
--<br>
/home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/test/ExecutionEngine/OrcLazy/Output/anonymous_globals.ll.script: line 1: 11213 Bus error               (core dumped) /home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/./bin/lli -jit-kind=orc-lazy /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/anonymous_globals.ll<br>
<br>
--<br>
<br>
********************<br>
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60..<br>
FAIL: LLVM :: ExecutionEngine/OrcLazy/global_aliases.ll (18064 of 25776)<br>
******************** TEST 'LLVM :: ExecutionEngine/OrcLazy/global_aliases.ll' FAILED ********************<br>
Script:<br>
--<br>
/home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/./bin/lli -jit-kind=orc-lazy /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/global_aliases.ll<br>
--<br>
Exit Code: 138<br>
<br>
Command Output (stderr):<br>
--<br>
/home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/test/ExecutionEngine/OrcLazy/Output/global_aliases.ll.script: line 1: 11214 Bus error               (core dumped) /home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/./bin/lli -jit-kind=orc-lazy /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/global_aliases.ll<br>
<br>
--<br>
<br>
********************<br>
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60..<br>
FAIL: LLVM :: ExecutionEngine/OrcLazy/hello.ll (18077 of 25776)<br>
******************** TEST 'LLVM :: ExecutionEngine/OrcLazy/hello.ll' FAILED ********************<br>
Script:<br>
--<br>
/home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/./bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll | /home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/./bin/FileCheck /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/hello.ll<br>
--<br>
Exit Code: 2<br>
<br>
Command Output (stderr):<br>
--<br>
FileCheck error: '-' is empty.<br>
<br>
--<br>
<br>
********************<br>
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60..<br>
FAIL: LLVM :: ExecutionEngine/OrcLazy/private_linkage.ll (18078 of 25776)<br>
******************** TEST 'LLVM :: ExecutionEngine/OrcLazy/private_linkage.ll' FAILED ********************<br>
Script:<br>
--<br>
/home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/./bin/lli -jit-kind=orc-lazy /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/private_linkage.ll<br>
--<br>
Exit Code: 138<br>
<br>
Command Output (stderr):<br>
--<br>
/home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/test/ExecutionEngine/OrcLazy/Output/private_linkage.ll.script: line 1: 11218 Bus error               (core dumped) /home/dim/obj/llvm-261275M-trunk-freebsd11-i386-ninja-rel-1/./bin/lli -jit-kind=orc-lazy /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/private_linkage.ll<br>
<br>
--<br>
<br>
********************<br>
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.<br>
FAIL: LLVM-Unit :: ExecutionEngine/Orc/OrcJITTests/OrcCAPIExecutionTest.TestLazyIRCompilation (24756 of 25776)<br>
******************** TEST 'LLVM-Unit :: ExecutionEngine/Orc/OrcJITTests/OrcCAPIExecutionTest.TestLazyIRCompilation' FAILED ********************<br>
Note: Google Test filter = OrcCAPIExecutionTest.TestLazyIRCompilation<br>
[==========] Running 1 test from 1 test case.<br>
[----------] Global test environment set-up.<br>
[----------] 1 test from OrcCAPIExecutionTest<br>
[ RUN      ] OrcCAPIExecutionTest.TestLazyIRCompilation<br>
<br>
********************<br>
<br>
Unfortunately, the debugger seems to have trouble following the execution, so it does not really show anything interesting in the stack trace:<br>
<br>
(gdb) run<br>
Starting program: /home/dim/obj/llvm-orc-r260338/bin/lli -jit-kind=orc-lazy /share/dim/src/llvm/trunk/test/ExecutionEngine/OrcLazy/private_linkage.ll<br>
[New Thread 29612000 (LWP 101099)]<br>
<br>
Program received signal SIGBUS, Bus error.<br>
[Switching to Thread 29612000 (LWP 101099)]<br>
0x28fa600f in ?? ()<br>
(gdb) bt<br>
#0  0x28fa600f in ?? ()<br>
#1  0x2913aff5 in ?? ()<br>
#2  0x0815adcd in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)<br>
    at /share/dim/src/llvm/trunk/tools/lli/lli.cpp:414<br>
<br>
It appears to die on an fxsave instruction, though:<br>
<br>
(gdb) disassemble 0x28fa6000,0x28fa6020<br>
Dump of assembler code from 0x28fa6000 to 0x28fa6020:<br>
   0x28fa6000:  push   %ebp<br>
   0x28fa6001:  mov    %esp,%ebp<br>
   0x28fa6003:  push   %eax<br>
   0x28fa6004:  push   %ebx<br>
   0x28fa6005:  push   %ecx<br>
   0x28fa6006:  push   %edx<br>
   0x28fa6007:  push   %esi<br>
   0x28fa6008:  push   %edi<br>
   0x28fa6009:  sub    $0x21c,%esp<br>
=> 0x28fa600f:  fxsave 0x10(%esp)<br>
   0x28fa6014:  mov    0x4(%ebp),%esi<br>
   0x28fa6017:  sub    $0x5,%esi<br>
   0x28fa601a:  mov    %esi,0x4(%esp)<br>
   0x28fa601e:  movl   $0x296182c0,(%esp)<br>
End of assembler dump.<br>
(gdb) info registers<br>
eax            0xbfbfe6e0       -1077942560<br>
ecx            0x2913bff0       689160176<br>
edx            0x3      3<br>
ebx            0x905e994        151382420<br>
esp            0xbfbfd58c       0xbfbfd58c<br>
ebp            0xbfbfd7c0       0xbfbfd7c0<br>
esi            0xbfbfd7f0       -1077946384<br>
edi            0xbfbfd820       -1077946336<br>
eip            0x28fa600f       0x28fa600f<br>
eflags         0x210292 [ AF SF IF RF ID ]<br>
cs             0x33     51<br>
ss             0x3b     59<br>
ds             0x3b     59<br>
es             0x3b     59<br>
fs             0x3b     59<br>
gs             0x1b     27<br>
<br>
Any ideas on how to debug this further?<br>
<span><font color="#888888"><br>
-Dimitry<br>
<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>