https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112019-01-10T10:46:52ZRuby Issue Tracking SystemRuby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762072019-01-10T10:46:52Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>Also, it would be nice if the JIT output used different markup, which does not collide with Redmine markup :/</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762082019-01-10T11:08:11Zsharkcz (Dan Horák)
<ul></ul><p>IMHO either something calls __multi3 and doesn't link to libgcc or gcc emits call to __multi3 and it's not implemented in libgcc.<br>
Would be useful to see /tmp/_ruby_mjit_p20163u1.c source and the command line used to compile/link it.</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762102019-01-10T11:36:00Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>The smaller reproducer probably is:</p>
<pre><code>$ ruby --disable-gems --jit-verbose=10 --jit-min-calls=1 --jit-debug --jit-wait --jit-save-temps -e "
begin
def foo
a = 0
[1, 2].each do |i|
a += i
[3, 4].each do |j|
a *= j
end
end
a
end
print foo
end"
</code></pre> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762112019-01-10T11:48:13Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul><li><strong>File</strong> <a href="/attachments/7611">_ruby_mjit_p207u2.c</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/7611/_ruby_mjit_p207u2.c">_ruby_mjit_p207u2.c</a> added</li></ul><p>This should be the C code (although generated on my x86_64, because I don't have aarch64 readily available).</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762132019-01-10T12:39:59Zk0kubun (Takashi Kokubun)takashikkbn@gmail.com
<ul></ul><blockquote>
<p>Also, it would be nice if the JIT output used different markup, which does not collide with Redmine markup :/</p>
</blockquote>
<p>Yeah. I'll change that later.</p>
<blockquote>
<p>This should be the C code (although generated on my x86_64, because I don't have aarch64 readily available).</p>
</blockquote>
<p>How did you get the output in the ticket description? If possible, I want you to upload rb_mjit_min_header-2.6.0.h under install directory and the exact /tmp/_ruby_mjit_p20163u1.c whose .so can't be loaded.</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762142019-01-10T12:42:39Zk0kubun (Takashi Kokubun)takashikkbn@gmail.com
<ul><li><strong>Assignee</strong> set to <i>k0kubun (Takashi Kokubun)</i></li></ul> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762162019-01-10T14:06:12Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul><li><strong>Assignee</strong> deleted (<del><i>k0kubun (Takashi Kokubun)</i></del>)</li></ul><p>k0kubun (Takashi Kokubun) wrote:</p>
<blockquote>
<blockquote>
<p>Also, it would be nice if the JIT output used different markup, which does not collide with Redmine markup :/</p>
</blockquote>
<p>Yeah. I'll change that later.</p>
</blockquote>
<p>Thx</p>
<blockquote>
<blockquote>
<p>This should be the C code (although generated on my x86_64, because I don't have aarch64 readily available).</p>
</blockquote>
<p>How did you get the output in the ticket description?</p>
</blockquote>
<p>That is from builder which is not easily accessible. I can throw in SRPM and get resulting logs and RPMs, but I cannot easily access the intermediate results :/</p>
<blockquote>
<p>If possible, I want you to upload rb_mjit_min_header-2.6.0.h under install directory and the exact /tmp/_ruby_mjit_p20163u1.c whose .so can't be loaded.</p>
</blockquote>
<p>I will see what I can do about it. Hopefully, <a class="user active user-mention" href="https://redmine.ruby-lang.org/users/18304">@sharkcz (Dan Horák)</a> will be able to help :)</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762232019-01-10T14:56:00Zk0kubun (Takashi Kokubun)takashikkbn@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p>Thank you. I'll wait for that first.<br>
Also having logs with --jit-verbose=2 version of <a href="https://bugs.ruby-lang.org/issues/15522#note-3" class="external">https://bugs.ruby-lang.org/issues/15522#note-3</a> would be helpful.</p>
<p>P.S. The output format is changed in r66781.</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762412019-01-11T10:02:07Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul><li><strong>File</strong> <a href="/attachments/7614">rb_mjit_min_header-2.6.0.h</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/7614/rb_mjit_min_header-2.6.0.h">rb_mjit_min_header-2.6.0.h</a> added</li><li><strong>File</strong> <a href="/attachments/7615">mjit_multi3.tgz</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/7615/mjit_multi3.tgz">mjit_multi3.tgz</a> added</li><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Open</i></li></ul><p>So here is the output:</p>
<pre><code>$ ruby --disable-gems --jit-verbose=2 --jit-min-calls=1 --jit-debug --jit-wait --jit-save-temps -e "
begin
def foo
a = 0
[1, 2].each do |i|
a += i
[3, 4].each do |j|
a *= j
end
end
a
end
print foo
end"
MJIT: CC defaults to /usr/bin/gcc
MJIT: tmp_dir is /tmp
Creating precompiled header
Starting process: /usr/bin/gcc /usr/bin/gcc -w -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_hp111u0.h.gch /opt/rh/rh-ruby26/root/usr/include/rb_mjit_min_header-2.6.0.h
start compilation: foo@-e:3 -> /tmp/_ruby_mjit_p111u0.c
Starting process: /usr/bin/gcc /usr/bin/gcc -w -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_p111u0.o /tmp/_ruby_mjit_p111u0.c -c -Wl,-z,relro -nostartfiles -nodefaultlibs -nostdlib
Starting process: /usr/bin/gcc /usr/bin/gcc -shared -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_p111u0.so /tmp/_ruby_mjit_p111u0.o -Wl,-z,relro -nostartfiles -nodefaultlibs -nostdlib
MJIT warning: failure in loading code from '/tmp/_ruby_mjit_p111u0.so': /tmp/_ruby_mjit_p111u0.so: undefined symbol: __multi3
start compilation: block in foo@-e:5 -> /tmp/_ruby_mjit_p111u1.c
Starting process: /usr/bin/gcc /usr/bin/gcc -w -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_p111u1.o /tmp/_ruby_mjit_p111u1.c -c -Wl,-z,relro -nostartfiles -nodefaultlibs -nostdlib
Starting process: /usr/bin/gcc /usr/bin/gcc -shared -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_p111u1.so /tmp/_ruby_mjit_p111u1.o -Wl,-z,relro -nostartfiles -nodefaultlibs -nostdlib
MJIT warning: failure in loading code from '/tmp/_ruby_mjit_p111u1.so': /tmp/_ruby_mjit_p111u1.so: undefined symbol: __multi3
start compilation: block (2 levels) in foo@-e:7 -> /tmp/_ruby_mjit_p111u2.c
Starting process: /usr/bin/gcc /usr/bin/gcc -w -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_p111u2.o /tmp/_ruby_mjit_p111u2.c -c -Wl,-z,relro -nostartfiles -nodefaultlibs -nostdlib
Starting process: /usr/bin/gcc /usr/bin/gcc -shared -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_p111u2.so /tmp/_ruby_mjit_p111u2.o -Wl,-z,relro -nostartfiles -nodefaultlibs -nostdlib
MJIT warning: failure in loading code from '/tmp/_ruby_mjit_p111u2.so': /tmp/_ruby_mjit_p111u2.so: undefined symbol: __multi3
168Stopping worker thread
Successful MJIT finish
</code></pre>
<p>Header and the content of /tmp directory (except the .gch, which was huge :/) are attached.</p>
<p>k0kubun (Takashi Kokubun) wrote:</p>
<blockquote>
<p>P.S. The output format is changed in r66781.</p>
</blockquote>
<p>Nice, thanks!</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762422019-01-11T10:42:14Zsharkcz (Dan Horák)
<ul></ul><p>I suppose "-nostartfiles -nodefaultlibs -nostdlib" are the reason that libgcc isn't linked into the _ruby_mjit_p111u0.so</p>
<p>__multi3 is provided in /lib64/libgcc_s-4.8.5-20150702.so.1</p>
<p>I guess -nodefaultlibs should be omitted and/or -static-libgcc added. Skipping libgcc seems dangerous in general on any arch.</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762442019-01-11T11:10:16Zk0kubun (Takashi Kokubun)takashikkbn@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>k0kubun (Takashi Kokubun)</i></li></ul><blockquote>
<p>Header and the content of /tmp directory (except the .gch, which was huge :/) are attached.</p>
</blockquote>
<p>Thanks! Much appreciated.</p>
<blockquote>
<p>I suppose "-nostartfiles -nodefaultlibs -nostdlib" are the reason that libgcc isn't linked into the _ruby_mjit_p111u0.so</p>
<p>__multi3 is provided in /lib64/libgcc_s-4.8.5-20150702.so.1</p>
</blockquote>
<p>Possibly. It's causing issues on <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: MJIT compilation terminated due to -Wfatal-errors on GCC 7.3.0 (Closed)" href="https://redmine.ruby-lang.org/issues/15513">#15513</a> as well... I'll try to fix it.</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762492019-01-11T16:11:09Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>sharkcz (Dan Horák) wrote:</p>
<blockquote>
<p>I guess -nodefaultlibs should be omitted and/or -static-libgcc added. Skipping libgcc seems dangerous in general on any arch.</p>
</blockquote>
<p>I removed <code>-nodefaultlibs</code> and it changed nothing. But reading GCC options <a href="https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html" class="external">1</a> manual, the <code>-nostdlib</code> description, it says:</p>
<blockquote>
<p>In other words, when you specify -nostdlib or -nodefaultlibs you should usually specify -lgcc as well.</p>
</blockquote>
<p>and indeed after adding <code>-lgcc</code>, the build passed. Also, the <code>-lgcc</code> is already used in some cases <a href="https://github.com/ruby/ruby/blame/trunk/mjit_worker.c#L277" class="external">2</a>, maybe it should be used in all cases ...</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762922019-01-14T06:18:57Zk0kubun (Takashi Kokubun)takashikkbn@gmail.com
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>Applied in changeset trunk|r66812.</p>
<hr>
<p>mjit_worker.c: pass -lgcc to GCC platforms</p>
<p>using <code>-nodefaultlibs -nostdlib</code>.</p>
<p>I assume libgcc is needed when we use -nostdlib, and it's linked on some<br>
platforms but not linked on some platforms (like aarch64, and possibly<br>
AIX as well) as said in <a href="https://wiki.osdev.org/Libgcc" class="external">https://wiki.osdev.org/Libgcc</a> :</p>
<blockquote>
<p>You can link with libgcc by passing -lgcc when linking your kernel<br>
with your compiler. You don't need to do this unless you pass the<br>
-nodefaultlibs option (implied by -nostdlib)</p>
</blockquote>
<p>Also note that -nostdlib is not strictly needed (rather implied<br>
-nodefaultlibs is problematic for Gentoo like Bug#15513, which will be<br>
approached later) but helpful for performance. So I want to keep it for<br>
now.</p>
<p>[Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: TestJIT#test_compile_insn_local fails on aarch64 RHEL7 (Closed)" href="https://redmine.ruby-lang.org/issues/15522">#15522</a>]</p>
<p>I'm not trying to add <code>-nodefaultlibs -nostdlib</code> for AIX in this commit<br>
because AIX RubyCI is dead right now, but I'll try to add them again<br>
once RubyCI is fixed.</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=762932019-01-14T06:32:09Zk0kubun (Takashi Kokubun)takashikkbn@gmail.com
<ul></ul><p><a class="user active user-mention" href="https://redmine.ruby-lang.org/users/703">@vo.x (Vit Ondruch)</a> Could you check if r66812 works?</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=763032019-01-14T08:09:55Zk0kubun (Takashi Kokubun)takashikkbn@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN</i> to <i>2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED</i></li></ul> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=763082019-01-14T11:58:49Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>k0kubun (Takashi Kokubun) wrote:</p>
<blockquote>
<p><a class="user active user-mention" href="https://redmine.ruby-lang.org/users/703">@vo.x (Vit Ondruch)</a> Could you check if r66812 works?</p>
</blockquote>
<p>Actually it is r66811 + r66812. Applying these two patches, the test suite passes on RHEL7 on all supported architectures and it keeps passing on Fedora Rawhide on all supported architectures. Thx for the fix.</p> Ruby master - Bug #15522: TestJIT#test_compile_insn_local fails on aarch64 RHEL7https://redmine.ruby-lang.org/issues/15522?journal_id=763772019-01-17T21:54:33Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Backport</strong> changed from <i>2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED</i> to <i>2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE</i></li></ul><p>ruby_2_6 r66849 merged revision(s) 66811,66812,66816.</p>